I'm trying do some debugging in the Immediate Window
, how do you execute things such as Assembly.Get...()
? The only thing I get is The name 'Assembly' does not exist in the current context
. I do have using System.Reflection
at the stack that I'm looking at, I even have code such as
Assembly ass = Assembly.GetCurrentExecutingAssembly();
But running Assembly.GetEntryAssembly()
again trying to poke around in the Immediate Window
still doesn't work.
One thing though, is that the code I am trying to debug is from my other dll
that I compiled. Does it change anything? It has using System.Reflection;
on the file that I'm trying to debug.
error CS0103: The name 'Assembly' does not exist in the current context
Update :
Actually, is weird, it looks like I lost access to the Assembly
when the code is in another dll. See below, at the stacks where you see Hello.exe
I can access Assembly
just fine, however, as soon as it tries to execute code that are from my other dll, I can't grab the Assembly
.
MyProgram.Assembly.dll!MyProgram.Xml.XAdESBuilder.AddTimeStampNode() Line 195 C# Symbols loaded.
Hello.exe!MyProgram.Crate.EDSCrateXMLBuilder.BuildRootNode() Line 458 C# Symbols loaded.
Hello.exe!MyProgram.Crate.EDSCrateXMLBuilder.Build(MyProgram.Logger provided) Line 140 C# Symbols loaded.
Hello.exe!MyProgram.Crate.CrateSigner.Crate() Line 82 C# Symbols loaded.
Hello.exe!MyProgram.GUI.SignCrate() Line 463 C# Symbols loaded.
Hello.exe!MyProgram.GUI.BtnSignCrate_Click.AnonymousMethod__28_0() Line 320 C# Symbols loaded.
[External Code] Annotated Frame
Update2 :
In reply to Wendy's comment, here is the hierarchy. I have 2 VS solutions, one is to build a giant merged Assembly that will be use by other program. So in MyProgram.Assembly
solution, i has several projects, each project would build their own dll, then I have my Assembly
project, this one would merge all other dlls together generating my MyProgram.Assembly.dll
.
Then MyOtherProgram
would add a Reference
towards MyProgram.Assembly.dll
and use it just like any other dll.
I'd also like to point out that, the code itself have access to Assembly
, just not the Immediate Window
, for example:
Assembly assembly = Assembly.GetExecutingAssembly();
assembly.GetType(); // set break point here
If I set my breakpoint at the above mentioned code, then type Assembly
in Immediate Window
it would still say Assembly not found, but I can see in Autos
that the visible is being set properly.
Please note that, there is nothing wrong with my programs, everything runs as expected, but to get there, I had to write code and re-run the program many times just to know what values I was getting from Assembly
until I finally got what i wanted... it just that it was very frustrating and annoying not be able to debug it using Immediate Window
as I think it should.
I get the same error message when there has two projects in a solution and I don't selected any of them in Solution Explorer.
So please make sure you have selected one of project in Solution Explorer and then type command in Immediate Window.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.