473,657 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BUG???- Reflection.asse mbly.GetCalling Assembly returns different values when compiled for Debug or Release

I'm getting two different results when I call
System.Reflecti on.Assembly.Get CallingAssembly when compiling in Release and
debug modes. When i compile my application using the "Debug" configuration
my call to GetCallingAssem bly returns the assembly name of the project that
contains my form and class(as expected). When i compile using the "Release"
configuration GetCallingAssem bly 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 getCallingAssem blyName() As String

Return
System.Reflecti on.Assembly.Get CallingAssembly .GetCallingAsse mbly.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

MsgBox(Class1.g etCallingAssemb lyName)

End Sub

Any Ideas????

Thanks,

Shawn

Nov 20 '05 #1
0 1525

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

Similar topics

6
2023
by: Brad | last post by:
My company is setting up a deployment process for implementing .NET Windows applications. One of the standards we want the process to enforce is verifying that the assembly is built in release mode. Is there a way to check an assembly to determine if it was built in release mode? The deployment application will not have access to source code, just the compiled assembly, so I am assuming I will need to use reflection. However, I have not...
3
2471
by: frazer | last post by:
hi, I have an assembly with many classes in it. and some of the methods in those classes have this attribute StoredProcedure before them, which takes different values . (i basically use it to store storedprocedure names that this function calls.) public void GetCustomers() {
8
2536
by: Eyeawanda Pondicherry | last post by:
I have put some code together that creates an enum dynamically from some database values. The enum can be read perfectly by an application that references the dynamically generated dll. If I /emit/ a new version of the assembly, and start the application again, the new values will appear for the enum. However, suppose I want the application to remain in a running state.
0
1106
by: MWells | last post by:
I have a simple VS.NET solution with Project "A" as a web app and Project "B" as a class library. "B" does some HTML rendering, and uses reflection to locate and load the necessary rendering classes. The behavior I'm trying to create is that; A gives a rendering instruction to B B uses reflection to locate the specified Renderer
2
1873
by: john | last post by:
Maybe I haven't had that "a-ha" moment yet, but I think the new approach to web projects is a step in the wrong direction. My main beef is that control over the assembly generation process has been taken away from us! I also don't agree with the logic behind a web site not having a project file, but I'll save that for another thread! Here's our scenario: We have a web project that runs in a non-managed sharepoint directory. The web...
1
17804
by: Patrick | last post by:
Has been trying to get an ASP.NET DLL's modification date/time for the "release date/time" to be displayed on the page's footer Using: System.Reflection.Assembly asm=System.Reflection.Assembly.GetExecutingAssembly(); appVer = asm.GetName().Version.ToString(); // get the location of our executing assembly System.IO.FileInfo inf = new System.IO.FileInfo(asm.Location);
3
4395
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
7
5621
by: bonk | last post by:
I have a c# project as part of a larger VS 2005 solution that always gets build optimized and I therefore can not evaluate any values while debugging through the code ("Cannot evaluate expression because the code of the current method is optimized."). This happens alltough the checkbock "optimize code" in the project settings is switched off. My question here is what are possible conditions that would make an assembly be build as optimized...
7
2677
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file name based on the name of the VB6 application. A second choice would be a file name based on the # COM interface assembly. I have tried calling Assembly.GetCallingAssembly() but this fails when I use the VB6 client. Is there a way to get this...
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.