5

I have a C# stack trace that contains lines like this:

at MyNamespace.WCFService.<DispatchWork>b__4(Task`1 t)
at MyNamespace.TestMethods.<RunTestCode>d__0.MoveNext()
at MyNamespace.ServiceProxy.<CallService>d__4a.MoveNext()

What does b__4, d__0, and d__4a mean?

What's the difference between b__ and d__? Can there be any other characters (besides d and b)?

What's the stuff after __?

Sebastian Krysmanski
  • 8,114
  • 10
  • 49
  • 91
  • Nothing special. Automatically generated classes and methods only. Pretty common when using lambdas, yield or async. Is your question about the specific naming scheme the compiler applies? – Jonas Bötel Nov 07 '13 at 09:04
  • 1
    Good rundown from Eric Lippert as an answer here: http://stackoverflow.com/questions/2508828/where-to-learn-about-vs-debugger-magic-names – Paddy Nov 07 '13 at 09:08

1 Answers1

3

These names are automatically generated by the compiler for temp variables, yield instructions, lambdas and ...

There are only two cases which you can see these names, one of them is what compiler generates and the other is when someone chooses to obfuscate his assembly. Obfuscated assemblies have names like these for their methods and classes as well.

See this for more detailed info about what compiler does when generating names (pointed out in the comments).

Community
  • 1
  • 1
asm
  • 508
  • 5
  • 7