Closed tugberkugurlu closed 10 years ago
You need to use the fully-qualified name, and then add Simplifier.Annotation
.
Doesn't work :disappointed:
Am I doing something wrong: https://github.com/DotNetAnalyzers/NullParameterCheckRefactoring/commit/91868474bd7512f395f6962851ccb7605505dad7?
It looks like it's working to me, assuming it inserts just ArgumentNullException
when the file does contain a using System;
declaration.
Weird, I cannot get it working in my box. It always adds it as System.ArgumentNullException
if I don't have a using statement for System
. Is this the right place to add Simplifier.Annotation
: https://github.com/DotNetAnalyzers/NullParameterCheckRefactoring/commit/91868474bd7512f395f6962851ccb7605505dad7#diff-cdeec3cc19b47b81331208ac85ae1c83R107?
The important part is that it always inserts a valid reference to System.ArgumentNullException
. You also want it to use the shortest form available during the code fix. For now you probably won't get it to automatically insert the using System;
statement, but this is arguably a bad idea anyway (perhaps the user omitted it on purpose).
When there is no
System
using statement or the class/struct is not under aSystem
orSystem.*
namespace, the current implementation is buggy:Questions: