>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.
>
>~~BonnieYes, 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.