Issue after upgrading package from "Mindscape.Raygun4Net" to "Raygun4Xamarin.Forms" in xamarin forms project

Vaibhav Malokar

Posted on
Dec 13 2022

I have upgraded Mindscape.Raygun4Net package to the latest version of Raygun4Xamarin.Forms in my xamarin forms project but some of the things like "AttachPulse()" method, "RaygunSendingMessageEventArgs" parameter, "RaygunClient.Current.SendingMessage" etc are not supported after upgrade. Please let me know any alternative for these.


Jason Fauchelle

Raygun

Posted on
Dec 13 2022

Hi Vaibhav Malokar,

Thanks for upgrading to the Raygun4Xamarin.Forms provider.

"AttachPulse" has been replaced with "EnableRealUserMonitoring". RUM setup and feature documentation for Xamarin.Forms can be found here.

The event that gets called before crash reports are sent to Raygun is "RaygunClient.Current.BeforeSendingCrashReportEvent" which uses the "RaygunSendingCrashReportEventArgs". This is briefly described here.

Let us know if you have further questions and we'll help you out.


Vaibhav Malokar

Posted on
Dec 14 2022

Hello Jason Fauchelle. Thanks for your response. I found your solution really helpful. But still I am not able to find workaround for below methods,

RaygunClient.Initialize(API_KEY).AttachCrashReporting().AttachPulse((Activity)activity) RaygunClient.Current?.SendingBackground(exception, tags, customAttrs)

Could you please help me get replacement for above methods.


Jason Fauchelle

Raygun

Posted on
Dec 15 2022

Hi Vaibhav Malokar,

Your first line of code would now need to be done across multiple lines, such as the following:

RaygunClient.Init("_API_KEY_");
RaygunClient.Current.EnableCrashReporting();
RaygunClient.Current.EnableRealUserMonitoring();

That code is recommended to go in the Application class. Note that to capture platform specific information, you'd also need the following:

In the Android MainActivity.OnCreate method:

RaygunPlatform.Configure(this);

In the iOS AppDelegate.FinishedLaunching method:

RaygunPlatform.Configure();

The documentation is a bit more detailed, showing where that code generally sits. (That documentation is Crash Reporting specific, so you just need to also include the EnableRealUserMonitoring method that I mentioned).

For sending a crash report in a background thread, the Raygun4Xamarin.Forms provider does not have an equivalent of this. I'll mention this to the provider team, but don't know if/when this functionality would be implemented. For now, you'd need to call the RaygunClient.Current.Send method in a thread to achieve the same functionality. If you do this often, you may want to wrap this up in an extension method.

I hope that further helps you out.


Reply