When compiling a simple anonymous type, for example:
public class Test
{
public static void Main()
{
var my_anonymous = new { Name = "anonymous"};
}
}
IL code has a Debugger attribute for each generated method of an anonymous type. for example for equals:
.method public hidebysig virtual instance bool
Equals(object 'value') cil managed
{
.custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
...
Why does the compiler automatically generate it? I compiled it using Microsoft (R) Visual C # Compiler version 4.6.1055.0 and (if that matters) without using VS cmd.
Note. this answer is to remove the attribute (not possible), but I'm wondering about “Why?”.
source
share