473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Debugging 3rd party (or Microsoft) assemblies

Hello,

I know tools like Lutz Roeder's Reflector can be used to disassemble an
assembly into any number of .NET languages and this is invaluable for
debugging 3rd party (e.g. Microsoft) components. There are many times when
debugging my own code leads deep into a 3rd party component and an exception
may occur within that 3rd party component. By using VS' debugger, I can see
the call stack, which gives me information on the method that raised the
exception but of course I can't debug the code to see the arguments and the
exact managed statement that caused a problem.

I'm aware of tools like Mike Stall's Mdbg that allows one to go to the
disassembly of .NET assembly during runtime. As cool as this is, it is
limited by the fact that you can't see the value of any variables; you can
step through the IL but you can't view any locals which greatly limits its
use for debugging.

The only thing I can think of to achieve effective debugging (short of
looking at the native disassembly which I'm not brave enough to try) is to
disassemble the 3rd party assembly and then rebuild it with debug symbols.
This is where my question comes in. Does any tool you know of allow one to
take an assembly and generate C# (or VB .NET) source code for the entire
assembly, rather than on a method by method basis such that it is easy to
rebuild the assembly? A problem I see in rebuilding the assembly would be to
ensure that rebuilt assembly is signed with the identical strong name as the
orginal assembly so that references from other code are still valid and I
don't have to rebuild a large tree of assemblies. Is this possible?

Thanks you,
Notre

May 4 '06 #1
9 2044
"Notre Poubelle" <no************@online.nospam> wrote in message
news:50**********************************@microsof t.com...
Hello,

I know tools like Lutz Roeder's Reflector can be used to disassemble an
assembly into any number of .NET languages and this is invaluable for
debugging 3rd party (e.g. Microsoft) components. There are many times
when
debugging my own code leads deep into a 3rd party component and an
exception
may occur within that 3rd party component. By using VS' debugger, I can
see
the call stack, which gives me information on the method that raised the
exception but of course I can't debug the code to see the arguments and
the
exact managed statement that caused a problem.

I'm aware of tools like Mike Stall's Mdbg that allows one to go to the
disassembly of .NET assembly during runtime. As cool as this is, it is
limited by the fact that you can't see the value of any variables; you can
step through the IL but you can't view any locals which greatly limits its
use for debugging.

The only thing I can think of to achieve effective debugging (short of
looking at the native disassembly which I'm not brave enough to try) is to
disassemble the 3rd party assembly and then rebuild it with debug
symbols.
This is where my question comes in. Does any tool you know of allow one
to
take an assembly and generate C# (or VB .NET) source code for the entire
assembly, rather than on a method by method basis such that it is easy to
rebuild the assembly? A problem I see in rebuilding the assembly would be
to
ensure that rebuilt assembly is signed with the identical strong name as
the
orginal assembly so that references from other code are still valid and I
don't have to rebuild a large tree of assemblies. Is this possible?
http://www.codeproject.com/dotnet/De...rk_Classes.asp

Thanks you,
Notre

May 4 '06 #2
Notre,
A problem I see in rebuilding the assembly would be to
ensure that rebuilt assembly is signed with the identical strong name as the
orginal assembly so that references from other code are still valid and I
don't have to rebuild a large tree of assemblies. Is this possible?


No. If it was, the whole strong name system would be broken.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 4 '06 #3
You can find a bit of info with tools like ProcessExplorer
(sysinternals.com), but it does not give you everything you would need. I am
not sure if there is a tool that can poke as deeply as you would like.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
"Notre Poubelle" <no************@online.nospam> wrote in message
news:50**********************************@microsof t.com...
Hello,

I know tools like Lutz Roeder's Reflector can be used to disassemble an
assembly into any number of .NET languages and this is invaluable for
debugging 3rd party (e.g. Microsoft) components. There are many times
when
debugging my own code leads deep into a 3rd party component and an
exception
may occur within that 3rd party component. By using VS' debugger, I can
see
the call stack, which gives me information on the method that raised the
exception but of course I can't debug the code to see the arguments and
the
exact managed statement that caused a problem.

I'm aware of tools like Mike Stall's Mdbg that allows one to go to the
disassembly of .NET assembly during runtime. As cool as this is, it is
limited by the fact that you can't see the value of any variables; you can
step through the IL but you can't view any locals which greatly limits its
use for debugging.

The only thing I can think of to achieve effective debugging (short of
looking at the native disassembly which I'm not brave enough to try) is to
disassemble the 3rd party assembly and then rebuild it with debug
symbols.
This is where my question comes in. Does any tool you know of allow one
to
take an assembly and generate C# (or VB .NET) source code for the entire
assembly, rather than on a method by method basis such that it is easy to
rebuild the assembly? A problem I see in rebuilding the assembly would be
to
ensure that rebuilt assembly is signed with the identical strong name as
the
orginal assembly so that references from other code are still valid and I
don't have to rebuild a large tree of assemblies. Is this possible?

Thanks you,
Notre

May 5 '06 #4
Thank you Ben. This was a great article. I've followed the instructions to
disassemble & reassemble the assembly, but I am having trouble adding an
assembly to the GAC. The error messages is

Failure in adding the assembly to the cache: Strong name signature could not
be verified. Was the assembly built delay-signed?

I tried using gacutil /i <assemblyname> and gacutil /i <assemblyname> /f

Any further suggestions?

Notre
May 8 '06 #5
Hi Mattias,

Sorry for being slow, but I'm not sure what you're saying. Are you saying
that one cannot replace one assembly with another and maintain a working
strong name system?

Thanks,
Notre
May 8 '06 #6
I found a way to get this working almost perfectly.

I used the strong name utility (sn) to register my rebuilt assembly to skip
verification (-Vr). This got past the earlier error message I was getting,
and I was able to put the assembly into the GAC.

The only glitch I have now is that when I set breakpoint in the IL they are
hit, but I'm having trouble clearing the breakpoints!

I'm using VS 2005. I used the symbol files I generated as part of the
assembly re-creation. I associate the pdbs with the assembly I placed in the
GAC and the symbols are loaded properly. I then use the IDE to set
breakpoints in IL and these are hit, but when I attempt to delete the
breakpoints, they are still hit (even though they appear cleared in the IDE)!
Any hints or workarounds?

Thanks,
Notre
May 8 '06 #7
Hi Notre,

The strong name system is a way to maintain certain assembly is published
by certain publisher. A key is used to sign it to make sure that others
cannot modify it. If the assembly is modified, the key token will be
changed. Which means that you cannot modify the assembly and re-assign it,
unless you have the publisher's key file.

If this can be done, the whole strong named system will be broken. HTH.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 10 '06 #8
Thank you Kevin. I managed to get something to appear to work by disabling
strong name verification on my assembly before placing it into the GAC. This
is sufficient for my debugging needs (except the problem I'm having with
clearing the IL breakpoints). By disabling the strong name verification on
the assembly, what am I losing?

Thanks,
Notre
May 10 '06 #9
Hi Notre,

If this is only for debugging, I think OK. But it might break the reference
change for other assemblies, if other assemblies are referencing it with
strong named signature.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

May 10 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeff Langston | last post by:
The one request I have for the .net framework, or actually the compilers, would be to statically link assemblies at compile time. This way you can compile your application into one executable...
3
by: Development | last post by:
I am creating 10 threads that do ecatly the same thing. I am having a very hard time debugging this scenario. It seems that by default when you are doing f10 or f11 all threads execute. You can...
1
by: Zanna | last post by:
Hi all! I hope someone can help me. I have in my lan a PC with IIS installed and this works as web server. On another PC I have VS.net 2003 installed. I'd like to debug asp/aspx pages on...
1
by: Troy | last post by:
Anyone have any experience with remote debugging? We have a colocation server that we are developing on and we would like to enable remote debugging. I have installed all of the necessary...
2
by: Alex Clark | last post by:
Hi All, My system: WinXP Pro, VS.NET 2003, SQL Server Personal Edition. I'm having problems with my old favourite demon, SQL Debugging from within VS.NET. I have to say I've found this...
8
by: Charles Law | last post by:
I'm sorry to keep harping on about this one, but it is really quite important for me to be able to list _all_ required assemblies in my Help About box. Herfried kindly posted some code before that...
0
by: sameer | last post by:
Hi all, My new computer has Microsoft Windows XP Media Center Edition as the operating system. I am trying to run VStudio 2003 , ASP.NET on IIS 5.0 but every single time i run the source code of...
5
by: phnimx | last post by:
Hi , We have developed a number of plug-in .NET Library Components that we typically deploy with our various applications by installing them into the GAC. Each of the applications contains an...
5
by: Bhawna | last post by:
Hi, I am struggling with an issue related to debugging code in VC++ .net Ver 7.0, for last 2-3 days without any notion for what is happening. Actually I have made some changes to my source code...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.