Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Equivalent of VFP's LineNo() and Program() ?
Message
From
24/05/2005 12:40:51
 
 
To
24/05/2005 11:48:26
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01017003
Message ID:
01017128
Views:
20
>Hey Alex,
>
>The StackTrace is useful, but I don't think you've used it correctly. Try the StackTrace property of the Exception that got thrown. IOW, something like this:
>
>catch (Exception ex)
>{
>	MessageBox.Show(ex.Message + (char)13 +
>			ex.StackTrace.ToString());
>}
>
>In debug mode it will give you the correct line number.
>
>~~Bonnie


Yes, I understand and I use that. But the app I'm building you may remember, is a console app with no UI. So I write Exceptions and events to an XML log. I do not like to use the Windows EventLog and prefer to keep my own XML file in the same dir as the EXE for this app.

When I have an Exception it works fine. The question arises when I want to just log an event or a warning. I want to add my own messaging to at strategic points. I'd like to add the line number to those messages (there is no exception object there).

As I mentioned I found that the debugger includes line numbers but the release exe does not so it always shows zero. At least I haven't found a switch for it. In VFP it's on by default unless you want to strip debug info from the exe. That's my point.

Thx.


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform