Silverlight error logging

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, Alex.Davies, melvyn.harbour

Silverlight error logging

Postby gkneo » Wed Oct 20, 2010 3:48 pm

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:
Code: Select all
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
Code: Select all
    SmartAssembly.ReportException.ExceptionReporting.Report(ex);


This library references SA's SDK library (SmartAssembly.ReportException.dll)

Regards,

Guillermo
gkneo
 
Posts: 4
Joined: Wed Oct 20, 2010 3:31 pm
Location: Spain

Postby Chris.Allen » Mon Oct 25, 2010 1:27 pm

HI, yes, I believe this is possible- you will need to use the SDK and, as you say, simply call the Report method directly.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby gkneo » Wed Nov 03, 2010 5:03 pm

Hi,
I have only found the following method to use in my SL app:
Code: Select all
SmartAssembly.SmartExceptionsCore.UnhandledExceptionHandler.ReportException(Exception e, object[] obj)


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:

Code: Select all
threw an exception of type 'System.TypeInitializationException'
    base {System.SystemException}: {System.TypeInitializationException: Se produjo una excepción en el inicializador de tipo de 'SmartAssembly.SmartExceptionsCore.UnhandledExceptionHandler'. ---> System.FormatException: No se puede reconocer la cadena como un tipo booleano válido.
   en System.Boolean.Parse(String value)
   en System.Convert.ToBoolean(String value)
   en SmartAssembly.SmartExceptionsCore.UnhandledExceptionHandler..cctor()
   --- Fin del seguimiento de la pila de excepciones internas ---}
    TypeName: "SmartAssembly.SmartExceptionsCore.UnhandledExceptionHandler"



As I said before, I want to report handled exceptions. Is this is the right method to use?
gkneo
 
Posts: 4
Joined: Wed Oct 20, 2010 3:31 pm
Location: Spain

Postby iosub » Fri Nov 05, 2010 2:55 am

Hi

I'm having the same problem..

Is there a solution ?

Thank you
iosub
 
Posts: 19
Joined: Tue Oct 19, 2010 3:40 pm

Postby Chris.Allen » Mon Nov 15, 2010 4:00 pm

Sorry for the delay. Here is the workaround:
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.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby gkneo » Mon Nov 15, 2010 6:53 pm

Hi, Chris.

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.
gkneo
 
Posts: 4
Joined: Wed Oct 20, 2010 3:31 pm
Location: Spain

Postby Chris.Allen » Mon Nov 29, 2010 8:16 pm

Yes, it should bring up the form as usual.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby gkneo » Wed Dec 01, 2010 11:53 am

Is it possible to show the form only for unhandled exceptions, but send reports in the background whenever I want ?

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?
gkneo
 
Posts: 4
Joined: Wed Oct 20, 2010 3:31 pm
Location: Spain

Postby Chris.Allen » Tue Dec 07, 2010 4:29 pm

Sorry guys but the workaround does not seem to be working. I have logged a formal bug report for this (internal reference SA-615).
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby iosub » Tue Dec 07, 2010 4:30 pm

Wrong Post...
iosub
 
Posts: 19
Joined: Tue Oct 19, 2010 3:40 pm


Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 0 guests