public void MessageWithUserInfo()
    {
      RaygunIdentifierMessage user = new RaygunIdentifierMessage("Robbie Robot") { IsAnonymous = true };
      _client.UserInfo = user;

      RaygunMessage message = _client.ExposeBuildMessage(_exception);
      Assert.AreEqual("Robbie Robot", message.Details.User.Identifier);
      Assert.IsTrue(message.Details.User.IsAnonymous);
    }
Ejemplo n.º 2
0
 private void StripAndSend(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo, DateTime? currentTime)
 {
     foreach (Exception e in StripWrapperExceptions(exception))
       {
     Send(BuildMessage(e, tags, userCustomData, userInfo, currentTime));
       }
 }
Ejemplo n.º 3
0
 protected RaygunMessage BuildMessage(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfoMessage, DateTime? currentTime)
 {
     var message = RaygunMessageBuilder.New
     .SetEnvironmentDetails()
     .SetTimeStamp(currentTime)
     .SetMachineName(Environment.MachineName)
     .SetExceptionDetails(exception)
     .SetClientDetails()
     .SetVersion(ApplicationVersion)
     .SetTags(tags)
     .SetUserCustomData(userCustomData)
     .SetUser(userInfoMessage ?? UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : null))
     .Build();
       return message;
 }
Ejemplo n.º 4
0
 protected RaygunMessage BuildMessage(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfoMessage)
 {
     return BuildMessage(exception, tags, userCustomData, userInfoMessage, null);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Asynchronously transmits an exception to Raygun.io.
 /// </summary>
 /// <param name="exception">The exception to deliver.</param>
 /// <param name="tags">A list of strings associated with the message.</param>
 /// <param name="userCustomData">A key-value collection of custom data that will be added to the payload.</param>
 /// <param name="userInfo">Information about the user including the identity string.</param>
 public void SendInBackground(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo)
 {
     DateTime? currentTime = DateTime.UtcNow;
       if (CanSend(exception))
       {
     ThreadPool.QueueUserWorkItem(c =>
     {
       try
       {
     StripAndSend(exception, tags, userCustomData, userInfo, currentTime);
       }
       catch (Exception)
       {
     // This will swallow any unhandled exceptions unless we explicitly want to throw on error.
     // Otherwise this can bring the whole process down.
     if (RaygunSettings.Settings.ThrowOnError)
     {
       throw;
     }
       }
     });
     FlagAsSent(exception);
       }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Transmits an exception to Raygun.io synchronously specifying a list of string tags associated
 /// with the message for identification, as well as sending a key-value collection of custom data.
 /// This uses the version number of the originating assembly.
 /// </summary>
 /// <param name="exception">The exception to deliver.</param>
 /// <param name="tags">A list of strings associated with the message.</param>
 /// <param name="userCustomData">A key-value collection of custom data that will be added to the payload.</param>
 /// <param name="userInfo">Information about the user including the identity string.</param>
 public void Send(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo)
 {
     if (CanSend(exception))
       {
     StripAndSend(exception, tags, userCustomData, userInfo, null);
     FlagAsSent(exception);
       }
 }
Ejemplo n.º 7
0
 public IRaygunMessageBuilder SetUser(RaygunIdentifierMessage user)
 {
     _raygunMessage.Details.User = user;
       return this;
 }
Ejemplo n.º 8
0
        protected RaygunMessage BuildMessage(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfoMessage, DateTime? currentTime)
        {
            exception = StripWrapperExceptions(exception);

              var message = RaygunMessageBuilder.New
            .SetEnvironmentDetails()
            .SetTimeStamp(currentTime)
            .SetMachineName(Environment.MachineName)
            .SetExceptionDetails(exception)
            .SetClientDetails()
            .SetVersion(ApplicationVersion)
            .SetTags(tags)
            .SetUserCustomData(userCustomData)
            .SetUser(userInfoMessage ?? UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : null))
            .Build();

              var customGroupingKey = OnCustomGroupingKey(exception, message);
              if (string.IsNullOrEmpty(customGroupingKey) == false)
              {
            message.Details.GroupingKey = customGroupingKey;
              }
              return message;
        }
Ejemplo n.º 9
0
        private RaygunIdentifierMessage BuildRaygunIdentifierMessage(string machineName)
        {
            RaygunIdentifierMessage message = UserInfo;
              string deviceId = DeviceId;

              if (message == null || message.Identifier == null) {
            if (!String.IsNullOrWhiteSpace (User)) {
              message = new RaygunIdentifierMessage (User);
            } else if(!String.IsNullOrWhiteSpace (deviceId)){
              message = new RaygunIdentifierMessage (deviceId) {
            IsAnonymous = true,
            FullName = machineName,
            UUID = deviceId
              };
            }
              }

              if (message != null && message.UUID == null) {
            message.UUID = deviceId;
              }

              return message;
        }
Ejemplo n.º 10
0
 public void UserInfoProperty()
 {
     RaygunIdentifierMessage user = new RaygunIdentifierMessage("Robbie Robot");
       _client.UserInfo = user;
       Assert.AreSame(user, _client.UserInfo);
 }
Ejemplo n.º 11
0
        public void UserInfoFromBuildTrumpsAll()
        {
            RaygunIdentifierMessage user = new RaygunIdentifierMessage("Not Robbie Robot") { IsAnonymous = true };
            _client.UserInfo = user;
            _client.User = "******";

            RaygunMessage message = _client.ExposeBuildMessage(_exception, null, null, new RaygunIdentifierMessage("Robbie Robot"));
            Assert.AreEqual("Robbie Robot", message.Details.User.Identifier);
            Assert.IsFalse(message.Details.User.IsAnonymous);
        }
Ejemplo n.º 12
0
        public void IsAnonymousDefault()
        {
            RaygunIdentifierMessage user = new RaygunIdentifierMessage("Robbie Robot");
              Assert.IsFalse(user.IsAnonymous);

              _client.User = "******";
              RaygunMessage message = _client.ExposeBuildMessage(_exception);
              Assert.IsFalse(message.Details.User.IsAnonymous);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Asynchronously transmits an exception to Raygun.io.
        /// </summary>
        /// <param name="exception">The exception to deliver.</param>
        /// <param name="tags">A list of strings associated with the message.</param>
        /// <param name="userCustomData">A key-value collection of custom data that will be added to the payload.</param>
        /// <param name="userInfo">Information about the user including the identity string.</param>
        public void SendInBackground(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo)
        {
            if (CanSend(exception))
              {
            // We need to process the HttpRequestMessage on the current thread,
            // otherwise it will be disposed while we are using it on the other thread.
            RaygunRequestMessage currentRequestMessage = BuildRequestMessage();
            DateTime currentTime = DateTime.UtcNow;

            ThreadPool.QueueUserWorkItem(c =>
            {
              try
              {
            _currentRequestMessage = currentRequestMessage;
            Send(BuildMessage(exception, tags, userCustomData, userInfo, currentTime));
              }
              catch (Exception)
              {
            // This will swallow any unhandled exceptions unless we explicitly want to throw on error.
            // Otherwise this can bring the whole process down.
            if (RaygunSettings.Settings.ThrowOnError)
            {
              throw;
            }
              }
            });
            FlagAsSent(exception);
              }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Transmits an exception to Raygun.io synchronously specifying a list of string tags associated
        /// with the message for identification, as well as sending a key-value collection of custom data.
        /// This uses the version number of the originating assembly.
        /// </summary>
        /// <param name="exception">The exception to deliver.</param>
        /// <param name="tags">A list of strings associated with the message.</param>
        /// <param name="userCustomData">A key-value collection of custom data that will be added to the payload.</param>
        /// <param name="userInfo">Information about the user including the identity string.</param>
        public void Send(Exception exception, IList<string> tags, IDictionary userCustomData, RaygunIdentifierMessage userInfo)
        {
            if (CanSend(exception))
              {
            _currentRequestMessage = BuildRequestMessage();

            Send(BuildMessage(exception, tags, userCustomData, userInfo, null));
            FlagAsSent(exception);
              }
        }