BUG???- Reflection.assembly.GetCallingAssembly returns different values when compiled for Debug or Release

Visual Studio108
I'm getting two different results when I call

System.Reflection.Assembly.GetCallingAssembly when compiling in Release and

debug modes. When i compile my application using the "Debug" configuration

my call to GetCallingAssembly returns the assembly name of the project that

contains my form and class(as expected). When i compile using the "Release"

configuration GetCallingAssembly unexpectedly returns System.Windows.Forms.



Below is some sample code that illustrates what i'm trying to do. DO NOT

test this code from the VS IDE. You must compile it and execute it from

explorer. When you run the code in the IDE you will get your application

assembly name as expected.



Create a new windows application and add the following class. Notice that

the function is a shared member:

Public Class Class1



Public Shared Function getCallingAssemblyName() As String



Return

System.Reflection.Assembly.GetCallingAssembly.GetCallingAssembly.FullName



End Function



End Class





Take form1 and place a button on the form with the following code in the

button click.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button1.Click



MsgBox(Class1.getCallingAssemblyName)



End Sub



Any Ideas????



Thanks,



Shawn


-