Silverlight error logging
gkneo
Posts: 5
Hi,
Aside from catching unhandled exceptions in my Silverlight 4.0 app (currently built using PRISM), I want to log errors on handled exceptions. I mean, in my Silverlight client, I would have:
The method LogError will use SA to send a report to its web service. Is that currently possible using the SA's?
I have already done this within a .net 4.0 library referenced by the web site hosting the SL client. I have a static method "LogError(Exception ex)" which calls
This library references SA's SDK library (SmartAssembly.ReportException.dll)
Regards,
Guillermo
Aside from catching unhandled exceptions in my Silverlight 4.0 app (currently built using PRISM), I want to log errors on handled exceptions. I mean, in my Silverlight client, I would have:
try { doSomething(); } catch (Exception e) { LogError(e); }
The method LogError will use SA to send a report to its web service. Is that currently possible using the SA's?
I have already done this within a .net 4.0 library referenced by the web site hosting the SL client. I have a static method "LogError(Exception ex)" which calls
SmartAssembly.ReportException.ExceptionReporting.Report(ex);
This library references SA's SDK library (SmartAssembly.ReportException.dll)
Regards,
Guillermo
Comments
I have only found the following method to use in my SL app:
It is located in the SmartExceptionsCoreSilverlight.dll library.
But this method doesn't work. I have used variations for the 2nd parameter and it always throws an exception:
As I said before, I want to report handled exceptions. Is this is the right method to use?
I'm having the same problem..
Is there a solution ?
Thank you
The library with the necessary files in isn’t included in the SDK for Silverlight but if, in your SL app, you create an empty ReportExceptionAttribute, then applies it to a Report method somewhere in your app like so:
[AttributeUsage(AttributeTargets.Method)]
private sealed class ReportExceptionAttribute : Attribute {}
[ReportException]
private static void Report(Exception exception)
{
throw new Exception("{report}", exception);
}
then run it through SA- this is enough for it to trigger the special hooks within SA that generate the right code to perform the reporting.
The actual bug has reference SA-615.
Will this bring up the Exception Reporting Form(In case I had configured to do)?
I want to show this form only when an unhandled exception is thrown, but when I catch the exception then I want to send the report in the background.
Regards,
Guillermo.
Imagine that I have a module which expects a response from a web service. The expected values are "A" or "B". For a particular reason, the web service returns "C", but my module handles this and shows a message to the user: "The service is down, try again later" An smartassembly report is sent in the background so the administrator is notified that the web service is doing wrong. Another module using a different web service also receives a bad response, but does not handle it and an unhandled exception is raised: smartassembly's form shows up to send the report.
I don't want to build from scratch this kind of "logging" system as I may use smartassembly's reporting feature. Is it possible?