Should sizeof error message recommend Marshal.SizeOf? #26513
Labels
Area-Compilers
Concept-Diagnostic Clarity
The issues deals with the ease of understanding of errors and warnings.
Milestone
Version Used: Roslyn 2.7.0 or master
Steps to Reproduce:
Try to compile the following code:
Actual Behavior:
Expected Behavior:
Since
Marshal.SizeOf()
is not a direct replacement forsizeof()
, maybe the error message should not mention it? On .Net Core, it could make sense to suggestUnsafe.SizeOf()
instead, but that method is not available on .Net Framework or .Net Standard out of the box (it requires the System.Runtime.CompilerServices.Unsafe package), so maybe that suggestion should be removed altogether?The text was updated successfully, but these errors were encountered: