what are <-Cannon> .ctor etc means when I get result

Code profiling for .NET developers.

Moderators: AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

what are <-Cannon> .ctor etc means when I get result

Postby hyang » Thu Mar 14, 2013 4:57 pm

Hi,
When I run performance profiler and output data to csv or excel. I saw some very weird words added into method names such as

<Startup>b__3<__Canon>()
Startup()
It<__Canon>(Func<T>)
ResolveAll<__Canon>()
<ResolveAll>b__9<__Canon>()
ResolveAllServices()
<Initialize>b__2<__Canon>()
Initialize()
TryResolveAll<__Canon>()
CreateShell(bool isVisible)
.ctor(IContainer container)


what does ".cctor()", or <_Canon> or b_numbers means
does any body know? or where i can find reference for these? is that possible to show as my normal methods names?

Thanks
hyang
 
Posts: 11
Joined: Thu Aug 16, 2012 11:00 pm

Postby jessica.ramos » Fri Mar 15, 2013 7:13 pm

Hello and thank you for your post!

When you see cctor() method in the results, it essentially means that the method is a constructor

I'm not so sure about <_Canon> or b_numbers -- did these methods come from an assembly that you do not have source for and used the integrated "decompile" option on?
Jessica Ramos
Technical Support
Red Gate Software Ltd.
jessica.ramos
 
Posts: 235
Joined: Mon Apr 23, 2012 1:13 pm

Postby dene.boulton » Mon Mar 18, 2013 2:55 pm

System.__Canon is an internal mscorlib type used to make the canonical instantiation of a generic type.

b_ is a compiler generated backing field.
Simple example:

Public string MyString { get; set; }

so becomes something like:

private string b_MyString;
public string get_MyString() { return b_MyString; }
public void set_MyString(string value) { b_MyString = value; }
Dene Boulton
Red Gate
dene.boulton
 
Posts: 53
Joined: Wed Oct 12, 2011 12:44 pm
Location: Cambridge

Postby hyang » Wed Mar 20, 2013 6:41 pm

Thanks a lot for reply.

what about these in the "class"

ConfigService+<>c__DisplayClass10
ConfigService+<>c__DisplayClass16
ConfigService+<>c__DisplayClass5<T>
ConfigService+<>c__DisplayClassd


what do these mean? thanks a lot
hyang
 
Posts: 11
Joined: Thu Aug 16, 2012 11:00 pm

Postby dene.boulton » Wed Mar 20, 2013 11:04 pm

Those are also compiler generated classes; for certain code the compiler needs to introduce actual constructs for things like classes, backing fields, variables etc.
Examples of when this is done are: lamba functions, anonymous functions, for keywords like Async and yield.

<> is used at the start of the generated construct names to avoid any collisions with "defined" code; <> is reserved for the compiler for this very purpose.
Dene Boulton
Red Gate
dene.boulton
 
Posts: 53
Joined: Wed Oct 12, 2011 12:44 pm
Location: Cambridge


Return to ANTS Performance Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests