"'??' left operand is never null" warning with Debug.Assert.

Hi,

public void Foo(string param)
{
  System.Diagnostics.Debug.Assert(param!=null);
  var newString = string.Format("{0}", (param??"<?>"));
}

Gives me warning "'??' left operand is never null", removing Assert clears it.
Is this a bug?

(p.s. would be good if ReSharper had some easy way to copy version info in about dialog).

Thanks.

0
1 comment
Avatar
Andrey Serebryansky

Hello Stefan,

ReSharper considers Debug.Assert as a terminating method (a method which
throws an exception if condition is not true). In order to avoid this behavior,
you can remove information about Debug.Assert from \ExternalAnnotations\System\System.xml.
Note that you should restart Visual Studio afterwards. Thank you


Andrey Serebryansky
Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hi,

public void Foo(string param)
{
System.Diagnostics.Debug.Assert(param!=null);
var newString = string.Format("{0}", (param??"<?>"));
}
Gives me warning "'??' left operand is never null", removing Assert
clears it. Is this a bug?

(p.s. would be good if ReSharper had some easy way to copy version
info in about dialog).

Thanks.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5245444#5245444



0

Please sign in to leave a comment.