runtime Informations (IDE its open?) (assembly compiled in debug mode?)

  • Thread starter Thread starter Marcelo Palladino
  • Start date Start date
M

Marcelo Palladino

Hi,

Somebody could tell me if exists a form of knowing, in time of execution,
if:

1 - IDE of the visual studio it is open?
2 - The assembly was compiled way "debug"?


Thank´s in advance,


Marcelo Palladino
 
Marcelo,
1 - IDE of the visual studio it is open?

Just out of curiosity, why would that matter to your application?

2 - The assembly was compiled way "debug"?

#if DEBUG
// it's a debug build
#else
// it's not
#endif



Mattias
 
Hi Mattias,

First, thank you for answered. As the question that you did it is the
following: I am developing an application that accepts plugins of third. In
the kernel of the loader mechanism there are several verifications to
evidence the assembly that will be carried it is of a known source or not.
Does happen that in the day by day, while the developers are creating the
plugins unpleasant it would be to do these verifications. For example, I
want to try to do something like that: If the programmer is in IDE, creating
therefore, I polish some verifications (in plugins loader kernel). An
example of as it can be unpleasant it is KeyFile. In the environment that am
creating a WEB service it exists (in a safe ambient) that does the paper of
key maker for the team. Now it imagines the guy tends to submit the assembly
every time that alters the plugin... (it can be that I am imagining things,
or that there are better solutions. I accept suggestions! ; -)

As the second leave, I think expressed myself badly. The one that I
wanted saying is the following: From Assembly "A" as I know if Assembly "B"
was compiled in debug mode?


Thank you again!



Marcelo Palladino
 
Marcelo,

For the first issue, perhaps you could use Debugger.IsAttached to
check if the application is running with a debugger attached. But it's
generally a bad idea to change the behavior of code depending on this,
since it makes it harder to find issues specific to release builds.

As the second leave, I think expressed myself badly. The one that I
wanted saying is the following: From Assembly "A" as I know if Assembly "B"
was compiled in debug mode?

You can use Reflection to check for the presence of the
DebuggableAttribute on the assembly. You can also consider using the
FileVersionInfo class and its IsDebug property.



Mattias
 
Mattias,

You are right! I will seek another form of doing this. Thank you very much
for your explanations.


Greetings,


Marcelo Palladino
 
Back
Top