Skip to content

Instantly share code, notes, and snippets.

@configureappio
Created September 15, 2021 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save configureappio/0368d42f08b9f3b1dc3abe89d31f6446 to your computer and use it in GitHub Desktop.
Save configureappio/0368d42f08b9f3b1dc3abe89d31f6446 to your computer and use it in GitHub Desktop.
using System;
public class C {
public void M(string value)
{
if (value is null!) throw new ArgumentNullException(nameof(value));
// works in NET 5 (C#9) but fails in 6 RC1 (C#10) with error CS8598: The suppression operator is not allowed in this context
// I can see why as the null does not need a null foriving as string is not a declared string?
// so it is correct to flag as a code smell, but should the error CS8598 be an error or a warning when migrating NET5 code?
}
}
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class C
{
public void M(string value)
{
}
}
{
"version": 1,
"target": "C#",
"mode": "Debug",
"branch": "main"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment