Preparing my app for ERROR

cwnonthehill

Member
Joined
Nov 5, 2012
Messages
20
Programming Experience
1-3
Hey guys,

I have completed work on my application, and during testing here in the office it occasionally will throw an Unhandled Exception error, mainly related to Crystal Reports which I know I can remedy by having CR installed on the end-user's PC. The one thing I find odd is that in those error logs you can actually see the location of my project folder, which is a major security issue here. My question is, how can I PROPERLY prepare my application with error handling for any possible unknowns that I might not be aware of?

Thanks,
CWN
 
Hi,

You need to implement Try / Catch / Finally statements at the appropriate points in your code to deal with your problem. Have a look here:-

Try...Catch...Finally Statement (Visual Basic)

Cheers,

Ian

Thanks for your reply Ian,
I have Try/Catch/Finally statements in my application, but those don't account for Errors of the sort I am unprepared for. Is there a way to globally handle these types of errors? For instance, the Application Events in VS2010 looks like what I might be needing...

Thanks,
CWN
 
Hi,

I have not had to deal with errors at this level before, but after a quick look, it seems like this is what you need to look into:-

My.Application.UnhandledException Event

Cheers,

Ian

That's what I've been considering, but I'd like to know if it is working somehow. Not sure how to test this unless i can TELL my app to throw an error for testing purposes? Also, I am trying to use my app.config file to enable error logging using the FileLog and EventLog, but when attempting to add the "custom=" and "customlocation=" to the FileLogWriter it says those attributes are not allowed?

Thanks,
Chris
 
Hi Chris,

Apologies, but that one is a bit beyond my knowledge at my current experience level in .NET so I am going to have to defer to one of the forum experts here to try and help you further.

Hope you get the answer you need. Good luck.

Cheers,

Ian
 
Not sure how to test this unless i can TELL my app to throw an error for testing purposes?
Use the Throw Statement (Visual Basic)
Also, I am trying to use my app.config file to enable error logging using the FileLog and EventLog, but when attempting to add the "custom=" and "customlocation=" to the FileLogWriter it says those attributes are not allowed?
You probably mean location="Custom". VS warns that it can't find those attributes in its schema. They are still valid, refers to properties of the FileLogTraceListener class, and works fine at runtime.
 
Back
Top