Skip to content

Commit aa7284c

Browse files
committed
Merge master and resolve conflict
2 parents cb0ea80 + 438c4c2 commit aa7284c

39 files changed

+419
-347
lines changed

Source/GlobalAssemblyInfo.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
[assembly: AssemblyProduct("Exceptionless")]
55
[assembly: AssemblyCompany("Exceptionless")]
66
[assembly: AssemblyTrademark("Exceptionless")]
7-
[assembly: AssemblyCopyright("Copyright (c) 2015 Exceptionless. All rights reserved.")]
7+
[assembly: AssemblyCopyright("Copyright (c) 2016 Exceptionless. All rights reserved.")]
88
#if DEBUG
99

1010
[assembly: AssemblyConfiguration("Debug")]
1111
#else
1212
[assembly: AssemblyConfiguration("Release")]
1313
#endif
1414

15-
[assembly: AssemblyVersion("3.3.0")]
16-
[assembly: AssemblyFileVersion("3.3.0")]
17-
[assembly: AssemblyInformationalVersion("3.3.0")]
15+
[assembly: AssemblyVersion("3.4.0")]
16+
[assembly: AssemblyFileVersion("3.4.0")]
17+
[assembly: AssemblyInformationalVersion("3.4.0")]
1818

1919
internal sealed partial class ThisAssembly {
2020
internal const string AssemblyCompany = "Exceptionless";
@@ -23,15 +23,15 @@ internal sealed partial class ThisAssembly {
2323

2424
internal const string AssemblyTrademark = "Exceptionless";
2525

26-
internal const string AssemblyCopyright = "Copyright (c) 2015 Exceptionless. All rights reserved.";
26+
internal const string AssemblyCopyright = "Copyright (c) 2016 Exceptionless. All rights reserved.";
2727

2828
internal const string AssemblyConfiguration = "Release";
2929

30-
internal const string AssemblyVersion = "3.3.0";
30+
internal const string AssemblyVersion = "3.4.0";
3131

32-
internal const string AssemblyFileVersion = "3.3.0";
32+
internal const string AssemblyFileVersion = "3.4.0";
3333

34-
internal const string AssemblyInformationalVersion = "3.3.0";
34+
internal const string AssemblyInformationalVersion = "3.4.0";
3535

3636
private ThisAssembly() {}
3737
}
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,60 @@
11
using System;
22
using System.Web;
3+
using Exceptionless.Dependency;
34
using Exceptionless.Plugins;
45
using Exceptionless.Extensions;
56
using Exceptionless.Logging;
67
using Exceptionless.Models;
7-
using Exceptionless.Models.Data;
88

99
namespace Exceptionless.Web {
1010
[Priority(90)]
1111
internal class ExceptionlessWebPlugin : IEventPlugin {
1212
private const string TAGS_HTTP_CONTEXT_NAME = "Exceptionless.Tags";
1313

1414
public void Run(EventPluginContext context) {
15-
HttpContextBase httpContext = context.ContextData.GetHttpContext();
15+
var httpContext = context.ContextData.GetHttpContext();
1616

1717
// if the context is not passed in, try and grab it
1818
if (httpContext == null && HttpContext.Current != null)
1919
httpContext = HttpContext.Current.ToWrapped();
2020

2121
if (httpContext == null)
2222
return;
23-
24-
// ev.ExceptionlessClientInfo.Platform = ".NET Web";
25-
if (context.Client.Configuration.IncludePrivateInformation
26-
&& httpContext.User != null
27-
&& httpContext.User.Identity.IsAuthenticated)
28-
context.Event.SetUserIdentity(httpContext.User.Identity.Name);
23+
24+
var serializer = context.Client.Configuration.Resolver.GetJsonSerializer();
25+
if (context.Client.Configuration.IncludePrivateInformation && httpContext.User != null && httpContext.User.Identity.IsAuthenticated) {
26+
var user = context.Event.GetUserIdentity(serializer);
27+
if (user == null)
28+
context.Event.SetUserIdentity(httpContext.User.Identity.Name);
29+
}
2930

3031
var tags = httpContext.Items[TAGS_HTTP_CONTEXT_NAME] as TagSet;
3132
if (tags != null)
3233
context.Event.Tags.UnionWith(tags);
34+
35+
var ri = context.Event.GetRequestInfo(serializer);
36+
if (ri != null)
37+
return;
3338

34-
RequestInfo requestInfo = null;
3539
try {
36-
requestInfo = httpContext.GetRequestInfo(context.Client.Configuration);
40+
ri = httpContext.GetRequestInfo(context.Client.Configuration);
3741
} catch (Exception ex) {
3842
context.Log.Error(typeof(ExceptionlessWebPlugin), ex, "Error adding request info.");
3943
}
4044

41-
if (requestInfo == null)
45+
if (ri == null)
4246
return;
4347

4448
var httpException = context.ContextData.GetException() as HttpException;
4549
if (httpException != null) {
4650
int httpCode = httpException.GetHttpCode();
4751
if (httpCode == 404) {
4852
context.Event.Type = Event.KnownTypes.NotFound;
49-
context.Event.Source = requestInfo.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false);
53+
context.Event.Source = ri.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false);
5054
}
5155
}
5256

53-
context.Event.AddRequestInfo(requestInfo);
57+
context.Event.AddRequestInfo(ri);
5458
}
5559
}
5660
}

Source/Platforms/WebApi/ExceptionlessWebApiPlugin.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
using System.Reflection;
66
using System.Security.Principal;
77
using System.Threading;
8-
using System.Web.Http.Controllers;
98
using Exceptionless.Dependency;
109
using Exceptionless.Plugins;
1110
using Exceptionless.Extensions;
1211
using Exceptionless.Logging;
1312
using Exceptionless.Models;
14-
using Exceptionless.Models.Data;
1513

1614
namespace Exceptionless.WebApi {
1715
[Priority(90)]
@@ -20,31 +18,40 @@ public void Run(EventPluginContext context) {
2018
if (!context.ContextData.ContainsKey("HttpActionContext"))
2119
return;
2220

23-
HttpActionContext actionContext = context.ContextData.GetHttpActionContext();
21+
var actionContext = context.ContextData.GetHttpActionContext();
2422
if (actionContext == null)
2523
return;
2624

27-
IPrincipal principal = GetPrincipal(actionContext.Request);
28-
if (context.Client.Configuration.IncludePrivateInformation && principal != null && principal.Identity.IsAuthenticated)
29-
context.Event.SetUserIdentity(principal.Identity.Name);
25+
var serializer = context.Client.Configuration.Resolver.GetJsonSerializer();
26+
if (context.Client.Configuration.IncludePrivateInformation) {
27+
var user = context.Event.GetUserIdentity(serializer);
28+
if (user == null) {
29+
IPrincipal principal = GetPrincipal(actionContext.Request);
30+
if (principal != null && principal.Identity.IsAuthenticated)
31+
context.Event.SetUserIdentity(principal.Identity.Name);
32+
}
33+
}
34+
35+
var ri = context.Event.GetRequestInfo(serializer);
36+
if (ri != null)
37+
return;
3038

31-
RequestInfo requestInfo = null;
3239
try {
33-
requestInfo = actionContext.GetRequestInfo(context.Client.Configuration);
40+
ri = actionContext.GetRequestInfo(context.Client.Configuration);
3441
} catch (Exception ex) {
3542
context.Log.Error(typeof(ExceptionlessWebApiPlugin), ex, "Error adding request info.");
3643
}
3744

38-
if (requestInfo == null)
45+
if (ri == null)
3946
return;
4047

41-
var error = context.Event.GetError(context.Client.Configuration.Resolver.GetJsonSerializer());
48+
var error = context.Event.GetError(serializer);
4249
if (error != null && error.Code == "404") {
4350
context.Event.Type = Event.KnownTypes.NotFound;
44-
context.Event.Source = requestInfo.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false);
51+
context.Event.Source = ri.GetFullPath(includeHttpMethod: true, includeHost: false, includeQueryString: false);
4552
}
4653

47-
context.Event.AddRequestInfo(requestInfo);
54+
context.Event.AddRequestInfo(ri);
4855
}
4956

5057
private static IPrincipal GetPrincipal(HttpRequestMessage request) {

Source/Platforms/WebApi/NuGet/readme.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the web.config Exceptionless section.
2323

2424
<exceptionless apiKey="API_KEY_HERE" />
2525

26-
Finally, you must import the "Exceptionless" namespace and call the following line
26+
Next, you must import the "Exceptionless" namespace and call the following line
2727
of code to start reporting unhandled exceptions. You will need to run code during
2828
application startup and pass it an HttpConfiguration instance. Please note that this
2929
code is normally placed inside of the WebApiConfig classes Register method.
@@ -34,6 +34,23 @@ If you are hosting Web API inside of ASP.NET, you would register Exceptionless l
3434

3535
Exceptionless.ExceptionlessClient.Default.RegisterWebApi(GlobalConfiguration.Configuration)
3636

37+
Finally, if you are targetting WebApi 2.1 or newer you will need to copy the following
38+
ExceptionLogger into your project and register it as a service.
39+
40+
using Exceptionless.Plugins;
41+
public class ExceptionlessExceptionLogger : ExceptionLogger {
42+
public override void Log(ExceptionLoggerContext context) {
43+
var contextData = new ContextData();
44+
contextData.MarkAsUnhandledError();
45+
contextData.SetSubmissionMethod("ExceptionLogger");
46+
contextData.Add("HttpActionContext", context.ExceptionContext.ActionContext);
47+
48+
context.Exception.ToExceptionless(contextData).Submit();
49+
}
50+
}
51+
52+
config.Services.Add(typeof(IExceptionLogger), new ExceptionlessExceptionLogger());
53+
3754
Please visit the wiki https://github.com/exceptionless/Exceptionless.Net/wiki/Sending-Events
3855
for examples on sending events to Exceptionless.
3956

Source/Samples/SampleConsole/packages.config

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<packages>
33
<package id="Exceptionless.DateTimeExtensions" version="3.1.44" targetFramework="net452" />
44
<package id="Exceptionless.RandomData" version="1.0.21.0" targetFramework="net452" />
5-
<package id="log4net" version="2.0.5" targetFramework="net451" />
6-
<package id="NLog" version="4.2.3" targetFramework="net451" />
7-
<package id="NLog.Config" version="4.2.3" targetFramework="net451" />
8-
<package id="NLog.Schema" version="4.2.3" targetFramework="net451" />
5+
<package id="log4net" version="2.0.5" targetFramework="net452" />
6+
<package id="NLog" version="4.2.3" targetFramework="net452" />
7+
<package id="NLog.Config" version="4.2.3" targetFramework="net452" />
8+
<package id="NLog.Schema" version="4.2.3" targetFramework="net452" />
99
</packages>

Source/Samples/SampleMvc/Controllers/ValuesController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public string Get(int id) {
2020
}
2121

2222
// POST api/values
23-
public void Post([FromBody] string value) {
23+
public void Post([FromBody] Person person) {
2424
throw new ApplicationException("WebApi POST error");
2525
}
2626

@@ -30,4 +30,8 @@ public void Put(int id, [FromBody] string value) {}
3030
// DELETE api/values/5
3131
public void Delete(int id) {}
3232
}
33+
34+
public class Person {
35+
public string Name { get; set; }
36+
}
3337
}

Source/Samples/SampleMvc/Exceptionless.SampleMvc.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<Private>True</Private>
5252
</Reference>
5353
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
54+
<HintPath>..\..\..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
5555
<Private>True</Private>
5656
</Reference>
5757
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
@@ -143,9 +143,9 @@
143143
<ItemGroup>
144144
<Content Include="Global.asax" />
145145
<Content Include="packages.config" />
146-
<None Include="Scripts\jquery-2.2.0.intellisense.js" />
147-
<Content Include="Scripts\jquery-2.2.0.js" />
148-
<Content Include="Scripts\jquery-2.2.0.min.js" />
146+
<None Include="Scripts\jquery-2.2.2.intellisense.js" />
147+
<Content Include="Scripts\jquery-2.2.2.js" />
148+
<Content Include="Scripts\jquery-2.2.2.min.js" />
149149
<Content Include="Web.config">
150150
<SubType>Designer</SubType>
151151
</Content>
@@ -191,7 +191,7 @@
191191
<Content Include="Views\Shared\NotFound.cshtml" />
192192
</ItemGroup>
193193
<ItemGroup>
194-
<Content Include="Scripts\jquery-2.2.0.min.map" />
194+
<Content Include="Scripts\jquery-2.2.2.min.map" />
195195
</ItemGroup>
196196
<PropertyGroup>
197197
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>

Source/Samples/SampleMvc/Scripts/jquery-2.2.0.min.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

Source/Samples/SampleMvc/Scripts/jquery-2.2.0.min.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)