Skip to content
mnaoumov.dev
Go back

obj.ToString(), nulls and ReSharper

I found that by default ReSharper annotates ToString() calls with NotNullAttribute which causes some false negative suggestions.

I agree that it is bad idea to return null from ToString() but it is not guaranteed by compiler and even BCL contains such cases

 new System.Web.HtmlString(null).ToString(); // returns null

Found the same issue here


Share this post on:

Previous Post
PowerShell Cmdlets sources
Next Post
Pluralsight - The best screencasts