So, porting a project from .NET 6 to .NET 8 should be as easy as changing the framework from one to the other, but this has to be done in BOTH the Project properties and the Publish settings or you get a rather peculiar error message about mismatching version numbers.

Found this out recently. The test project i used seems to run just fine, with a few warnings related to changes from .NET 6 to .NET 8, but compiles and gets published.

I ran Strings on the compiled binary and found that there are still some text references to .NET 6 in the binary like:

"System.Security.Permissions.SecurityPermissionAttribute, System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

I assume that this is some sort of left over reference created when the project was created, as the underlying runtime files now point to .NET 8 instead... i'm gonna try porting a larger project with many more dependencies and see if anything breaks.

#dotnet #porting #migration #dotnet6 #dotnet8

Ok, so i took two of the more complex projects i had with multiple external dependencies and tested then with the .NET 8 preview and - everything just worked. #neato!

Spoke too soon, apparently someone thought it would be a good idea now to force devs creating an AesGcm encryptor in .NET to provide a Nounce size.

The old API was
Object = New AesGcm(arrayByteKey)

Now it's
Object = New AesGcm(arrayByteKey, Int32NounceSize)

Can't understand what this was done at all, you normally just provide the cryptor/decryptor with the arrays: Key, Plaintext/Cipertext, #Nounce and Tag and you're done.

All sizes for Keys, data and nounces are (were) automatically sized according to the array size, and they were backwards compatible , as in creating a wrapper that worked for .NET 5, 6 and 7, but this is now broken and .NET 8 has to have a separate wrapper :P

Fuck i hate it when stuff like this happens!

Why can't people just let things be the way they are and stop changing things because they can?

Maybe i should just throw out my .NET cryptographic code for #cryptography and just use #Bouncycastle instead, which is you know *CONSISTENT* in it's API from version to version.

Got an explanation after reporting the issue in docs on Github.

Apparently people have no clue what they are doing (which is a great personal trait to have when doing cryptography) and this needed to be addressed by changing the behaviour totally to make sure that people who don't pay attention to their variable size don't shoot themselves in the foot.

And this breaks behaviour and i have to make a new cryptographic wrapper as of .NET 8 because of this crap.

If you are inputting byte arrays into cryptographic functions and have no clue what the size is, please go away and plant flowers instead, you're not apt to do cryptography.