File tree Expand file tree Collapse file tree 6 files changed +27
-2
lines changed Expand file tree Collapse file tree 6 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 54
54
<Compile Include =" Plugins\ErrorPlugin.cs" />
55
55
<Compile Include =" Plugins\PrivateInformationPlugin.cs" />
56
56
<Compile Include =" Plugins\TraceLogPlugin.cs" />
57
+ <Compile Include =" Plugins\SingleSessionPlugin.cs" />
57
58
<Compile Include =" Plugins\VersionPlugin.cs" />
58
59
<Compile Include =" ExceptionlessSection.cs" />
59
60
<Compile Include =" Extensions\EventBuilderExtensions.cs" />
Original file line number Diff line number Diff line change 13
13
using Exceptionless . Extras . Storage ;
14
14
using Exceptionless . Extras . Utility ;
15
15
using Exceptionless . Logging ;
16
+ using Exceptionless . Plugins ;
16
17
using Exceptionless . Storage ;
17
18
18
19
namespace Exceptionless {
@@ -28,6 +29,14 @@ public static void UseErrorPlugin(this ExceptionlessConfiguration config) {
28
29
config . AddPlugin < Plugins . ErrorPlugin > ( ) ;
29
30
}
30
31
32
+ /// <summary>
33
+ /// Ensures only a single user session will be created unless you specify a session id via the event builder.
34
+ /// NOTE: This should only be used on deskop applications. Using this in web farm scenarios is not advisable.
35
+ /// </summary>
36
+ public static void UseSingleSessionPlugin ( this ExceptionlessConfiguration config ) {
37
+ config . AddPlugin < SingleSessionPlugin > ( ) ;
38
+ }
39
+
31
40
public static void UseIsolatedStorage ( this ExceptionlessConfiguration config ) {
32
41
config . Resolver . Register < IObjectStorage > ( new IsolatedStorageObjectStorage ( config . Resolver ) ) ;
33
42
}
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public void Run(EventPluginContext context) {
8
8
return ;
9
9
10
10
var user = context . Event . GetUserIdentity ( ) ;
11
- if ( user == null || String . IsNullOrEmpty ( user . Identity ) )
11
+ if ( String . IsNullOrEmpty ( user ? . Identity ) )
12
12
context . Event . SetUserIdentity ( Environment . UserName ) ;
13
13
}
14
14
}
Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace Exceptionless . Plugins {
4
+ [ Priority ( 90 ) ]
5
+ public class SingleSessionPlugin : IEventPlugin {
6
+ private readonly string _sessionId = Guid . NewGuid ( ) . ToString ( "N" ) . Substring ( 0 , 16 ) ;
7
+
8
+ public void Run ( EventPluginContext context ) {
9
+ if ( String . IsNullOrEmpty ( context . Event . SessionId ) )
10
+ context . Event . SessionId = _sessionId ;
11
+ }
12
+ }
13
+ }
Original file line number Diff line number Diff line change @@ -15,12 +15,13 @@ public static class ExceptionlessWindowsExtensions {
15
15
/// <param name="client">The ExceptionlessClient.</param>
16
16
/// <param name="showDialog">Controls whether a dialog is shown when an unhandled exception occurs.</param>
17
17
public static void Register ( this ExceptionlessClient client , bool showDialog = true ) {
18
+ client . Configuration . UseSingleSessionPlugin ( ) ;
18
19
client . Startup ( ) ;
19
20
client . RegisterApplicationThreadExceptionHandler ( ) ;
20
21
21
22
// make sure that queued events are sent when the app exits
22
23
client . RegisterOnProcessExitHandler ( ) ;
23
-
24
+
24
25
if ( ! showDialog )
25
26
return ;
26
27
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public static class ExceptionlessWpfExtensions {
16
16
/// <param name="client">The ExceptionlessClient.</param>
17
17
/// <param name="showDialog">Controls whether a dialog is shown when an unhandled exception occurs.</param>
18
18
public static void Register ( this ExceptionlessClient client , bool showDialog = true ) {
19
+ client . Configuration . UseSingleSessionPlugin ( ) ;
19
20
client . Startup ( ) ;
20
21
client . RegisterApplicationThreadExceptionHandler ( ) ;
21
22
client . RegisterApplicationDispatcherUnhandledExceptionHandler ( ) ;
You can’t perform that action at this time.
0 commit comments