C# code works if running from Visual studio, but not from executable file?

L

linda.chen

Greeting.

We have a 6 year old application, which contains both managed (C#) and
unmanaged code (C++). For all the new components we try to create them
in C#. We build all projects (both C++ and C# code) into a solution
from visual studio .net 2003.

In out solution we have a project implementing a pretty complicated
math algorithm. This component usally work very well. But in a couple
weeks ago, a user found a case that our algorithm did not work
correctly.

We are trying to debug the problem. The odd thing is: when we run the
application from visual studio, it works from both debug and release
mode. But if we run it from the executable file directly (double click
on the exe file from the output folder), the application stop working
for that case.

Any idea what caused this problem? How do we debug our code in this
case? We have run out of the ideas.

Linda
 
K

Kevin Spencer

Can you define what you mean by "works," "work," and "stop working?" In
other words, what is the expected behavior? What is the behavior when you
are debugging? What is the behavior when you are not debugging? Also, is the
error occurring in the C# modules or the C++ modules?

Meanwhile, just a shot in the dark: See if there are any preprocessor
statements that affect the behavior of the app when debugging, as in

#if debug

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
M

Mubashir Khan

maths algorithm .... hmmmmmmm
what has changed in couple of weeks ..... hmmmmmmmm
is it new law for daylight saving ..... hmmmmmmm
 
O

oscar.acostamontesde

Greeting.

We have a 6 year old application, which contains both managed (C#) and
unmanaged code (C++). For all the new components we try to create them
in C#. We build all projects (both C++ and C# code) into a solution
from visual studio .net 2003.

In out solution we have a project implementing a pretty complicated
math algorithm. This component usally work very well. But in a couple
weeks ago, a user found a case that our algorithm did not work
correctly.

We are trying to debug the problem. The odd thing is: when we run the
application from visual studio, it works from both debug and release
mode. But if we run it from the executable file directly (double click
on the exe file from the output folder), the application stop working
for that case.

Any idea what caused this problem? How do we debug our code in this
case? We have run out of the ideas.

Linda

Hello Linda:
Have you tryed to do some loggin in your app? Try writing some
instrumentation code to a file and see the results after execution.
Best regards.
Oscar Acosta
 
R

Ron Allen

Linda,
Have you checked to make sure all variables are being properly
initialized? Sometimes the development environment will set things to 0 to
start with that will be set to a random value outside the environment if not
initialized.

Ron Allen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top