Viewing Debug vs Release assembly in ILDASM

G

Guest

What should I look for in ILDASM to see whether or not a given assembly is a
debug assembly and not a release assembly? (The assembly is .NET 2.0)

I tried looking at a debug assembly in the bin/debug directory and then I
looked at the release assembly in the bin/release directory.

Both contained these lines in the manifest:

// --- The following custom attribute is added automatically, do not
uncomment -------
// .custom instance void
[mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype
[mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (X X X X X
X X X)


Where the debug exe (X X X X X X X X) = ( 01 00 07 01 00 00 00 00 )

And the release exe (X X X X X X X X) = ( 01 00 02 00 00 00 00 00 )


So should I simply look for the 01 00 07 01 00 00 00 00 value to determine
if ANY given assembly is debuggable?
(Also, is there a difference between an exe and a dll?)
-----------

What is confusing me is a statement in another newsgroup where the author
states :
Through ILDASM, we can find that there is no Debuggable
attribute in the . . . assembly . . .

And from this he concludes that the give assembly is a Release assembly and
not a Debug assembly.

I'm not sure how to look for the Debuggable Attribute, other than what I
discovered on my own as stated above.

Could someone help me to understand this?
(Also, I'm not sure if I should post this here or, rather, in the CLI or CLR
newsgroups.)

Thanks,
Nick
 
G

Guest

NoNickname said:
What should I look for in ILDASM to see whether or not a given assembly is a
debug assembly and not a release assembly? (The assembly is .NET 2.0)

I think you're on the right track. I'd guess that your project's default
build settings are leading you astray. Check your release build for the
/ASSEMBLYDEBUG linker switch (Project settings/Linker/Debugging/Debuggable
Assembly).

By default this switch is set for both Debug and Release configurations for
some reason. Therefore by default your Release build does indeed generate a
debuggable assembly. Just disable this flag for your Release build and you
will see the expected difference in the manifest just.

Hope this helps.

Allan
 
M

Mattias Sjögren

So should I simply look for the 01 00 07 01 00 00 00 00 value to determine
if ANY given assembly is debuggable?

Well the actual values can probably differ depending on compiler and
compiler settings. What's your definition of "debuggable" anyway?

(Also, is there a difference between an exe and a dll?)

I don't think so.

What is confusing me is a statement in another newsgroup where the author
states :

That's still what I see here with the v2.0 C# command line compiler.

I'm not sure how to look for the Debuggable Attribute, other than what I
discovered on my own as stated above.

If you have loaded the assembly you can use
assembly.IsDefined(typeof(DebuggableAttribute)) or
assembly.GetCustomAttributes(typeof(DebuggableAttribute)) to check for
the attribute.


Mattias
 
J

Jeffrey Tan[MSFT]

Hi Nick,

Does the community's replies make sense to you? If you still have any
concern on this issue, please feel free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top