Skip to content

Commit 3c210dd

Browse files
authored
Warnings fix (#1419)
* Fixed main project and unit test warnings. * Remove redundant block from project file.
1 parent 16fe646 commit 3c210dd

18 files changed

+104
-64
lines changed

src/SIPSorcery.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737

3838
<PropertyGroup>
3939
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1;net462;net5.0;net6.0;net8.0</TargetFrameworks>
40-
<LangVersion>10.0</LangVersion>
40+
<LangVersion>12.0</LangVersion>
4141
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
4242
<NoWarn>$(NoWarn);SYSLIB0050</NoWarn>
43+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
4344
<GenerateDocumentationFile>true</GenerateDocumentationFile>
4445
<!-- Disable warning for missing XML doc comments. -->
4546
<NoWarn>$(NoWarn);CS1591;CS1573;CS1587</NoWarn>

src/app/SIPUserAgents/ISIPClientUserAgent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ public interface ISIPClientUserAgent
3838
SIPRequest Call(SIPCallDescriptor sipCallDescriptor);
3939
SIPRequest Call(SIPCallDescriptor sipCallDescriptor, SIPEndPoint serverEndPoint);
4040
void AckAnswer(SIPResponse sipResponse, string content, string contentType);
41-
void Cancel(string? reason = null);
41+
void Cancel(string reason = null);
4242
}
4343
}

src/app/SIPUserAgents/SIPB2BUserAgent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void AckAnswer(SIPResponse sipResponse, string content, string contentTyp
8080
m_uac.AckAnswer(sipResponse, content, contentType);
8181
}
8282

83-
public void Cancel(string? reason = null)
83+
public void Cancel(string reason = null)
8484
{
8585
logger.LogDebug("SIPB2BUserAgent Cancel.");
8686
m_uac.Cancel(reason);

src/app/SIPUserAgents/SIPClientUserAgent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public SIPRequest Call(SIPCallDescriptor sipCallDescriptor, SIPEndPoint serverEn
251251
/// Cancels an in progress call. This method should be called prior to the remote user agent server answering the call.
252252
/// <param name="reason">The reason for canceling the call.</param>
253253
/// </summary>
254-
public void Cancel(string? reason = null)
254+
public void Cancel(string reason = null)
255255
{
256256
try
257257
{
@@ -320,7 +320,7 @@ public void Cancel(string? reason = null)
320320
/// Hangs up an answered call. This method should be called after the remote user agent server answered the call.
321321
/// <param name="reason">The reason for hanging up the call.</param>
322322
/// </summary>
323-
public void Hangup(string? reason = null)
323+
public void Hangup(string reason = null)
324324
{
325325
if (m_sipDialogue == null)
326326
{

src/net/RTP/Packetisation/H265Depacketiser.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public class H265Depacketiser
3636
uint previous_timestamp = 0;
3737
List<KeyValuePair<int, byte[]>> temporary_rtp_payloads = new List<KeyValuePair<int, byte[]>>(); // used to assemble the RTP packets that form one RTP Frame
3838

39-
int writeNumber = 0;
4039
public virtual MemoryStream ProcessRTPPayload(byte[] rtpPayload, ushort seqNum, uint timestamp, int markbit, out bool isKeyFrame)
4140
{
4241
List<byte[]> nal_units = ProcessRTPPayloadAsNals(rtpPayload, seqNum, timestamp, markbit, out isKeyFrame);
@@ -124,7 +123,6 @@ protected virtual List<byte[]> ProcessH265Payload(byte[] rtp_payload, ushort seq
124123
// Returns a list of NAL Units (with no 00 00 00 01 header and with no Size header)
125124
protected virtual List<byte[]> ProcessH265PayloadFrame(List<KeyValuePair<int, byte[]>> rtp_payloads, out bool isKeyFrame)
126125
{
127-
bool? isKeyFrameNullable = null;
128126
List<byte[]> nal_units = new List<byte[]>(); // Stores the NAL units for a Video Frame. May be more than one NAL unit in a video frame.
129127

130128
//check payload for Payload headers 48 and 49

src/net/RTP/RTPHeaderExtensions/TransportWideCCExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace SIPSorcery.Net
2525
/// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
2626
///
2727
/// This extension carries a 16-bit sequence number (2 bytes of payload).
28-
/// The one-byte header is constructed as (id << 4) | (extensionSize - 1).
28+
/// The one-byte header is constructed as (id &lt;&lt; 4) | (extensionSize - 1).
2929
/// </summary>
3030
public class TransportWideCCExtension : RTPHeaderExtension
3131
{

src/net/WebRTC/RTCPeerConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public class RTCPeerConnection : RTPSession, IRTCPeerConnection
188188
private BcTlsCrypto _crypto;
189189
private DtlsSrtpTransport _dtlsHandle;
190190
private Task _iceInitiateGatheringTask;
191-
private new TaskCompletionSource<bool> _iceCompletedGatheringTask = new();
191+
private readonly TaskCompletionSource<bool> _iceCompletedGatheringTask = new();
192192

193193
private Dictionary<String, int> _rtpExtensionsUsed; // < Uri, Id>
194194

test/integration/SIPSorcery.IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFrameworks>net462;net8.0</TargetFrameworks>
55
<IsPackable>false</IsPackable>
66
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
7+
<!--<TreatWarningsAsErrors>True</TreatWarningsAsErrors>-->
78
</PropertyGroup>
89

910
<ItemGroup>

test/integration/core/SIPTransportIntegrationTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ public void TcpTrickleReceiveTest()
556556
/// received on server web socket SIP channel.
557557
/// </summary>
558558
[Fact]
559-
public async void WebSocketLoopbackSendReceiveTest()
559+
public async Task WebSocketLoopbackSendReceiveTest()
560560
{
561561
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
562562
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -601,7 +601,7 @@ public async void WebSocketLoopbackSendReceiveTest()
601601
/// SIP channels. Web sockets have special rules about detecting the end of sends.
602602
/// </summary>
603603
[Fact]
604-
public async void WebSocketLoopbackLargeSendReceiveTest()
604+
public async Task WebSocketLoopbackLargeSendReceiveTest()
605605
{
606606
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
607607
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

test/integration/net/DNS/DNSUnitTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
//-----------------------------------------------------------------------------
1717

1818
using System.Linq;
19+
using System.Threading.Tasks;
1920
using DnsClient;
2021
using Microsoft.Extensions.Logging;
2122
using SIPSorcery.SIP;
@@ -40,7 +41,7 @@ public DNSUnitTest(Xunit.Abstractions.ITestOutputHelper output)
4041
/// </summary>
4142
[Fact(Skip = "DNS Queries for QType.ANY are not supported widely in the wild.")]
4243
//[Fact]
43-
public async void LookupAnyRecordTest()
44+
public async Task LookupAnyRecordTest()
4445
{
4546
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
4647
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -72,7 +73,7 @@ public async void LookupAnyRecordTest()
7273
/// </summary>
7374
[Fact(Skip = "DNS Queries for QType.ANY are not supported widely in the wild.")]
7475
//[Fact]
75-
public async void LookupAnyRecordAsyncCacheTest()
76+
public async Task LookupAnyRecordAsyncCacheTest()
7677
{
7778
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
7879
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -132,7 +133,7 @@ public async void LookupARecordMethod()
132133
/// Test that a known AAAA record is resolved.
133134
/// </summary>
134135
[Fact]
135-
public async void LookupAAAARecordMethod()
136+
public async Task LookupAAAARecordMethod()
136137
{
137138
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
138139
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);
@@ -168,7 +169,7 @@ public async void LookupAAAARecordMethod()
168169
}
169170

170171
[Fact]
171-
public async void LookupSrvRecordMethod()
172+
public async Task LookupSrvRecordMethod()
172173
{
173174
logger.LogDebug("--> {MethodName}", System.Reflection.MethodBase.GetCurrentMethod().Name);
174175
logger.BeginScope(System.Reflection.MethodBase.GetCurrentMethod().Name);

0 commit comments

Comments
 (0)