Iain Fraser
Iain Fraser

Reputation: 6738

How do you debug an assembly loaded through Assembly.Load(byte[])?

I am creating a plugin for a product that loads plugin DLLs using Assembly.Load(byte[]). This is all very well and good, but it means that I have no conventional means of loading the debugging symbols to step through my code.

The crazy thing is, several months ago I was having the exact same issue and solved it - and boy was I proud of myself! So I know it can be done, I've just forgotten how!

I have a few vague memories of things I might have tried, but I can't tease the details out of my head:

Upvotes: 6

Views: 1589

Answers (1)

Mike Zboray
Mike Zboray

Reputation: 40818

If your assembly is strongly named, you can put the assembly in the GAC. Strongly named assemblies are always loaded from the GAC, even if it is loaded via Assembly.Load(byte[]). Then just put your in symbols in C:\Windows\symbols\dll or where ever is convenient. I do this all the time to debug our own product's plugin DLLs which are loaded by another application in a similar manner.

You can use gacutil to install it in the GAC. Remember to remove it when you're done debugging or you might end up running tests against an old version you GAC'd and forgot about.

Upvotes: 1

Related Questions