Share via


Assembly.GetCallingAssembly().FullName returning the wrong value in whidbey?

Here's a question I got this afternoon:

I have a C# assembly named AppDom. I execute the following line in the Main function of the assembly

Console.WriteLine(Assembly.GetCallingAssembly().FullName);

Visual studio.NET 2003 gives the output as ‘AppDom’ when I run the app(classic CTRL-F5 scenario) or debug it( using F5) from the IDE.

However, in Whidbey I get ‘mscorlib.dll’ as the output when I press F5. While running the app normally I get the actual assembly name ‘AppDom’ correctly. This behavior exists in both the release and debug builds of the application. If I run the application externally and attach the VS 2005 debugger I get ‘AppDom’ as the output.

Is this a deliberate change done in Whidbey?

 

Under VS.NET 2005 you are seeing the calling assembly as mscorlib.dll because the Visual Studio Hosting Process (vshost.exe) is enabled. The hosting process basically sits before your app and then calls into it thereby having the 1st assembly in the process be mscorlib.dll instead of your assembly name (in this case appdom). You can disable the VSHP by going to project properties and unchecking the check box for the Visual Studio Host Process.

Comments