Version and userInfo not being passed through to Raygun

benjimac93

Posted on
Jun 18 2018

Below is a code sample from our app. Neither the userInfo, not the application version is going through to Raygun.

    public void LogWebError(Exception ex, UserUI u)
    {
        var raygunClient = new RaygunClient();
        RaygunIdentifierMessage userInfo = null;

        if (u != null)
        {
            userInfo = new RaygunIdentifierMessage(u.UserName)
            {
                IsAnonymous = false,
                FullName = u.FullName,
                FirstName = u.FirstName,
                Email = u.UserName,
                UUID = u.UserKey.ToString()
            };

            raygunClient.User = u.UserName;
        }

        //raygunClient.ApplicationVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
        raygunClient.ApplicationVersion = "1.1.10004";

        try
        {
            raygunClient.Send(ex, new List<string> { Config.Environment }, null, userInfo);
        }
        catch (Exception) { }
    }

enter image description here


Scottie

Posted on
Jun 18 2018

Hi there,

Which Raygun library are you using and what version?

Thanks


benjimac93

Posted on
Jun 18 2018

Mindscape.Raygun4Net 5.5.4


Scottie

Posted on
Jun 18 2018

I'd suggest that you start a chat with one of the Raygun Support engineers. They'd likely need some info that you'd not want to post on a public forum - ie urls to the error in Raygun.


benjimac93

Posted on
Jun 18 2018

legend. Thanks scottie


Jason Fauchelle

Raygun

Posted on
Jun 18 2018

Hi Ben,

Turns out the solution to this is simple enough to respond here.

In the code you posted, you'll see that you're calling raygunClient.Send twice for the same exception instance. Your issue will be resolved if you remove that first raygunClient.Send call.

In Raygun you'll be seeing the exception sent from that first call which doesn't have the application version or user info set.

After sending an exception with Raygun4Net, the exception gets marked as sent, and so will ignore sending the same exception again a second time. So the second raygunClient.Send call there doesn't result in anything, and that's why you don't see the extra information.

The reason we don't let Raygun4Net do double sending is because there is a least 1 scenario we'd found after a normal Raygun4Net setup where an exception could get picked up twice, which chews through the monthly quota twice as fast. It's also nice to have if somehow an exception instance accidentally gets sent multiple times in a loop. Apologies for the confusion you've run into with this.

-Jason Fauchelle


benjimac93

Posted on
Jun 18 2018

Whoops. Mistake on my behalf whilst I was doing some testing

Ignore the first send it isn't usually there.

I'm not getting the extra info regardless :(


Jason Fauchelle

Raygun

Posted on
Jun 18 2018

Hi Ben,

Using the updated code, I have not been able to reproduce this problem.

If you have Raygun setup elsewhere in your code (e.g. automatic exception reporting via the http module), the exception may still be being sent before the code block you posted. Please put a breakpoint on the raygunclient.Send call within the try/catch and then look into the Data collection of the Exception instance to see if it contains the "AlreadySentByRaygun" string.

If not, please let me know what type of application you are working with, and details on how you've set up Raygun, so that I can try to build a repro project. Alternatively, you can send us a repro project, but don't include your application api key.

-Jason Fauchelle


benjimac93

Posted on
Jun 18 2018

That fixed it. Thanks so much Jason !


Jason Fauchelle

Raygun

Posted on
Jun 18 2018

Excellent, no worries Ben. Let us know anytime you have further questions.

-Jason Fauchelle


Reply