Red Gate forums :: View topic - Silverlight error logging
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

Silverlight error logging

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
gkneo



Joined: 20 Oct 2010
Posts: 4
Location: Spain

PostPosted: Wed Oct 20, 2010 3:48 pm    Post subject: Silverlight error logging Reply with quote

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:

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


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

Regards,

Guillermo
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 591

PostPosted: Mon Oct 25, 2010 1:27 pm    Post subject: Reply with quote

HI, yes, I believe this is possible- you will need to use the SDK and, as you say, simply call the Report method directly.
Back to top
View user's profile Send private message
gkneo



Joined: 20 Oct 2010
Posts: 4
Location: Spain

PostPosted: Wed Nov 03, 2010 5:03 pm    Post subject: Reply with quote

Hi,
I have only found the following method to use in my SL app:
Code:
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:
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?
Back to top
View user's profile Send private message
iosub



Joined: 19 Oct 2010
Posts: 19

PostPosted: Fri Nov 05, 2010 2:55 am    Post subject: Reply with quote

Hi

I'm having the same problem..

Is there a solution ?

Thank you
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 591

PostPosted: Mon Nov 15, 2010 4:00 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
gkneo



Joined: 20 Oct 2010
Posts: 4
Location: Spain

PostPosted: Mon Nov 15, 2010 6:53 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 591

PostPosted: Mon Nov 29, 2010 8:16 pm    Post subject: Reply with quote

Yes, it should bring up the form as usual.
Back to top
View user's profile Send private message
gkneo



Joined: 20 Oct 2010
Posts: 4
Location: Spain

PostPosted: Wed Dec 01, 2010 11:53 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 591

PostPosted: Tue Dec 07, 2010 4:29 pm    Post subject: Reply with quote

Sorry guys but the workaround does not seem to be working. I have logged a formal bug report for this (internal reference SA-615).
Back to top
View user's profile Send private message
iosub



Joined: 19 Oct 2010
Posts: 19

PostPosted: Tue Dec 07, 2010 4:30 pm    Post subject: Reply with quote

Wrong Post...
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group