I have one method that looks like this:
void throwException(string msg) { throw new MyException(msg); }
Now if I write
The [DoesNotReturn] attribute in System.Diagnostics.CodeAnalysis should be what you want.
[DoesNotReturn]
System.Diagnostics.CodeAnalysis
Reference: https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.codeanalysis.doesnotreturnattribute?view=netcore-3.1