Skip to content

Instantly share code, notes, and snippets.

@ViIvanov
Last active August 29, 2015 14:22
Show Gist options
  • Save ViIvanov/e2601fa78308a90f72af to your computer and use it in GitHub Desktop.
Save ViIvanov/e2601fa78308a90f72af to your computer and use it in GitHub Desktop.
// Overload of Debug.Assert with detailMessageFormat does not supported
// Debug.Assert has an overload with detailMessageFormat parameter: https://msdn.microsoft.com/en-us/library/cc190597(v=vs.110).aspx.
// This overload does not supported by R#:
// * No syntax highlighting and no validation of format arguments
// * Code analysises does not recognize this calls (null check not works)
class Program
{
static void Main() { }
static void M(int? value) {
System.Diagnostics.Debug.Assert(value != null, "value != null",
// No highlighting, no validation for arguments
"value = {0}", value, "ha-ha!");
// "Check expression for null suggestion" offered
System.Console.WriteLine(value.Value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment