DongMT

Hi all MSDN fan

I have a windows type program with C# 2003, And I need to set Argument to the Void Main.

I do it by Go to Menu "Project Properties" >> Configuration Properties >> Debugging>> Set comand line argument ="001" ( where "001" is my string will be take at first time to Main() argument.

Sub main(ByVal CmdArgs() As String) // same as this vb.net code

But my problem is I can not debug this program any more by Press key F11, it throuth out the message "Your program has been used in some where else ..."

How can I fix this problem

Thank you for your attention.

DongMT




Re: Visual C# IDE How to debug step by step when having a comand line arguments?

TaylorMichaelL

The error message you gave doesn't make any sense. Could you please post the entire message. Is this a console application or a WinForms application Setting a command line argument by itself will not cause such an error. It seems like you might already have your application running, perhaps through the debugger.

Michael Taylor - 10/19/07

http://p3net.mvps.org





Re: Visual C# IDE How to debug step by step when having a comand line arguments?

rtdev

I am using C# 2003 as well. I created a console application and set the argument just as you did. I was able to Press F11 and step into the Main method. Are you running the project in "Release" mode Or did you change other "Project Properties".

Also what is the complete error that you are getting That might shed some more light on what the problem is.






Re: Visual C# IDE How to debug step by step when having a comand line arguments?

DongMT

Im running it in the "Debug" mode, and change no other project property.

It will run well when I press Ctrl + F5 (mean without debug).

But in bebug step by step, i saw it go into Main() but will through a message

"Unhandle exception of type "System.InvalidOperationException accurred in system.drawing.dll"

Additional infomation: The project is currently in use else where "

that is all long string of the message I have.

Thank you so much.

DongMT, Vietnam, Asia






Re: Visual C# IDE How to debug step by step when having a comand line arguments?

TaylorMichaelL

When the exception is thrown the debugger should stop at the line where the exception occurred. What does the code do when it is throwing the exception You can also use the Stack property of the exception object.

The exception you mention is generally used when you attempt to do something on an object and the object is not in state to handle the request. For example trying to read a file that isn't opened or trying to commit a transaction that isn't active.

Michael Taylor - 10/22/07

http://p3net.mvps.org