|
|
I am trying to make an addin for a program using C#, is there anyway to follow the execution of the dll in the hosting program using Visual Studio .NET? Is there anyway I can set breakpoints and watch variables?? Any help is appreciated.
|
|
|
|
|
If the program is yours, make the dll part of the same solution. If it's not, attach the debugger to the program, and it will stop at breakpoints in your dll.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks for replying. The program isn't mine, and I just don't know how to attach the debugger to the program.
|
|
|
|
|
Attach is the third option in the debug menu.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
while using try-catch combination, I've assign a value to a reference type variable within
try block, but when I tried to use this variable within catch block it throw an exception (NullRefrenceException) or an error (use of unassigned local variable) occur.
my question is: the variables that has been declared, or had values assigned
for them in try block, how to deal with them in catch block.
the code I'm working on :
int i =0;
Socket remote;
try
{
remote = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
i = 5;
}
catch(Exception ee)
{
MessageBox.Show(i.ToString());
MessageBox.Show(remote.ToString());
} and why is that when i used a value type variable it works well.
|
|
|
|
|
remote is going to be null, given that you've had an exception, and it's not likely that i=5 threw it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
well, that is my qustion.
i need to assign a value to 'remote' in try block, and then use that value within catch block.
is there any direct way, or trick to do so.
|
|
|
|
|
Yes, make a call to the remote constructor which does not fail. There's no rocket science here. It's null going in, your attempt to assign a value is failing, and so it's still null. The fault is in your code, it needs to not make assumptions about things that may not have happened, because you were in a try block.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hussam Fattahi wrote: i need to assign a value to 'remote' in try block, and then use that value within catch block.
Usually the only things you would need to do in the catch block are cleanup type activities. If you are trying to show the error message to the user you should be doing something like this:
int i =0;
Socket remote = null;
try
{
remote = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
i = 5;
}
catch(Exception ee)
{
MessageBox.Show(i.ToString());
MessageBox.Show(ee.Message);
} The Socket remote = null; will remove the compiler issue about using an unassigned variable. Any variable that is used inside of a catch block must be explicitly assigned prior to it being used.
If the call to remote = new Socket(...) fails for any reason, remote will be null (in all cases), you will take an exception that puts you in your catch handler. At that point, remote is still null, so you are trying to run ToString() on a null reference, which you can't do.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
i want to make a transparent floating window application,
which floats on every application (powerpoint, explorer etc....)
n makes an image of below application to it transparent part.....
.
how to get started???
sushant kaura
|
|
|
|
|
Form.ShowTopMost<br />
Form.Opacity
|
|
|
|
|
|
Hi, I have a application that execute in a try icon, the app have a contextual menu with 2 options. The app start when start windows but I want that windows shutdown send a message to my app and it execute some function or if restart windwos the app execute other function. Can you help me?
Thanks.
|
|
|
|
|
Take a look at the SystemEvents.SessionEnding event.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Umm.. Im currently using visual studio 2005 and my problem is everytime i create a copy of a windows application project..(example WIndowsApplications2)
and i change its content using another pc..and everytime i compile it.. the original contents are the ones shown in the screen.. not the new thing i have already change...
and everytime i change the first form to be displayed in the program.cs the form that is being displayed is the last form being compiled. For example i've change it to form5 but its showing Form12...
please help... thank you very much...
|
|
|
|
|
Are you sure it's building ? Are you sure you're not working in debug and copying the release exe ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Im sure its building.. its compiling the whole application but it keeps showing the last form compiled..
i think the problem is because of its the copied file?
|
|
|
|
|
There are two folders, debug and release. I think you're copying one and building the other.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
im copying thw whole application when i tried to erase the exe file in the debug folder its just the same. it keeps showing the form that's not meant to be shown...
is there a way that i could run it with the new content?
its very frustrating...thanks for your help...
|
|
|
|
|
Within Visual Studio, if you have more than one project in your solution, and hit the
icon (or the key combination) to run, it will execute the one project
"set as startup project" (context menu item in solution explorer pane).
Maybe you have forgotten to set it to the one you want to run ?
|
|
|
|
|
How can I decompile a C# executible file and see the source code?
|
|
|
|
|
Eddymvp wrote: How can I decompile a C# executible file and see the source code?
With Lutz Roeder's Reflector[^]
NOTE: This will NOT give you the original source code. The compiler will make various optimisations to the code when it compiles it so the code that Reflector produces will be functionally equivalent but not the original.
|
|
|
|
|
I tried using that, but it doesn't give me the option to extract the class the create a new project.
|
|
|
|
|
Well... you didn't ask for that.
Do you really need a program to do that for you? You can just copy the code and paste it into a project that you create yourself.
---
single minded; short sighted; long gone;
|
|
|
|