Skip to content

Conversation

@ha-ves
Copy link
Contributor

@ha-ves ha-ves commented Nov 14, 2025

Initial support fixes for .NET 10 with TFM conditional compilation.
Will use 'latest' C# language version in the .csproj.

BouncyCastle.Cryptography package update. Also some TFM conditional compilation.

For some reason, Span<>.Reverse() is not a fluent pattern anymore, so I added FluentReverse() extension.

Unit & Integration Tests passed with some warnings/skips, build: .NET Framework 4.6.2 & .NET 10.

closes #1462


Copilot:

This pull request adds support for .NET 9 and .NET 10, updates dependencies, and improves cross-version compatibility throughout the codebase. It also introduces a new FluentReverse extension method to replace usages of LINQ's Reverse().ToArray() for better performance and clarity. Additionally, several cryptography and certificate handling routines are updated to use the latest APIs where available, and test projects are updated to target the new frameworks.

.NET 9/10 Support and Project File Updates

  • Added net9.0 and net10.0 to the TargetFrameworks in SIPSorcery.csproj, SIPSorcery.IntegrationTests.csproj, and SIPSorcery.UnitTests.csproj, and set LangVersion to latest for broader language feature support. [1] [2] [3]

Certificate and Cryptography Improvements

  • Updated BouncyCastle.Cryptography NuGet package to version 2.6.2.
  • Replaced deprecated and less secure certificate loading and PBKDF2 routines with modern equivalents for .NET 8+ and .NET 9+, using X509CertificateLoader.LoadPkcs12FromFile and Rfc2898DeriveBytes.Pbkdf2 where possible. [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated SslStream cipher suite logging to use the new NegotiatedCipherSuite property on .NET 5+.

Performance and Code Quality Enhancements

  • Introduced a new FluentReverse extension in TypeExtensions.cs and replaced all usages of .Reverse().ToArray() with .FluentReverse().ToArray() for improved efficiency and readability, especially in endianness conversion and STUN/TURN attribute processing. [1] [2] [3] [4] [5] [6] [7] [8]

Cross-Version I/O Improvements

  • Updated file and stream reading operations to use ReadExactly where available (.NET 9+), ensuring complete reads and better error handling. [1] [2]

Miscellaneous

  • Minor formatting and encoding fixes in source file headers.

These changes collectively modernize the codebase, enhance compatibility with future .NET versions, and improve maintainability and performance.

* Use 'latest' C# language version
* TFM conditional compilation
* update packages
* additional extensions
@sipsorcery
Copy link
Member

Thanks for the grunt. Will aim to give this PR a spin with a bunch of the demo apps this week to see if anything is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET 10 support

2 participants