What is "__nonvirtual"? And why does this decompiled C# code look weird?

I have a DLL open in dot peek and it's showing some code that looks weird to me.

On one line I have this:

    __nonvirtual (((UIElement) this).OnPreviewMouseRightButtonUp(e));

I have an idea of what this line does, but I don't see how this is valid C#.  What is that "__nonvirtual"?  

On another line, I have this:

    public MyClass()

Again, it's clear to me what this code does, but this is not valid C#.  That's not how you call a base constructor from a derived class.  

Am I misunderstanding something with regards to using dot peek?  On your website here http://confluence.jetbrains.com/display/NETCOM/Introducing+JetBrains+dotPeek it says that "dotPeek decompiles any .NET assemblies and presents them as C# code".  Unless I'm really wrong, this code is not valid C# code.  It does look like C# code though.  What gives?

Comment actions Permalink

Hello?  Is anybody here?  I still don't have an answer to this question and it's been a week.  Is this forum abandoned?

Comment actions Permalink


Sorry for a delay. Did you have a 'Show Compile-Generated Code' option enabled?
If you have this option disabled, could you please provide us this dll for investigation? It would be highly appreciated.

Thank you.

Comment actions Permalink

I can't send you the DLL because I work in a corporate environment, but I can send you screenshots.  I've attached two screenshots, one showing what the output looks like when I show compiler-generated code (Show.PNG) and one showing what it looks like when I hide compiler-generated code (Hide.PNG).  I've circled the interesting parts in red.  The base..ctor() remains in both (with some kind of encoding artifact) and the __nonvirtual remains in both.  So that setting is not the problem.

Comment actions Permalink

Got same unicode siquences when tried to "Go to Source" in VS 2010.
The class in question was not really existing in C# but was a COM Interop.


Please sign in to leave a comment.