@@ -15,6 +15,7 @@ namespace System.Runtime
15
15
internal class ExceptionTrace
16
16
{
17
17
private const ushort FailFastEventLogCategory = 6 ;
18
+ internal const int MaxExceptionStringLength = 28 * 1024 ;
18
19
private string _eventSourceName ;
19
20
private readonly EtwDiagnosticTrace _diagnosticTrace ;
20
21
@@ -34,21 +35,21 @@ public void TraceEtwException(Exception exception, EventLevel eventLevel)
34
35
case EventLevel . Warning :
35
36
if ( WcfEventSource . Instance . ThrowingEtwExceptionIsEnabled ( ) )
36
37
{
37
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
38
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
38
39
WcfEventSource . Instance . ThrowingEtwException ( _eventSourceName , exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
39
40
}
40
41
break ;
41
42
case EventLevel . Critical :
42
43
if ( WcfEventSource . Instance . EtwUnhandledExceptionIsEnabled ( ) )
43
44
{
44
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
45
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
45
46
WcfEventSource . Instance . EtwUnhandledException ( exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
46
47
}
47
48
break ;
48
49
default :
49
50
if ( WcfEventSource . Instance . ThrowingEtwExceptionVerboseIsEnabled ( ) )
50
51
{
51
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
52
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
52
53
WcfEventSource . Instance . ThrowingEtwExceptionVerbose ( _eventSourceName , exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
53
54
}
54
55
@@ -64,21 +65,21 @@ public void TraceEtwException(Exception exception, TraceEventType eventLevel)
64
65
case TraceEventType . Warning :
65
66
if ( WcfEventSource . Instance . ThrowingEtwExceptionIsEnabled ( ) )
66
67
{
67
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
68
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
68
69
WcfEventSource . Instance . ThrowingEtwException ( _eventSourceName , exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
69
70
}
70
71
break ;
71
72
case TraceEventType . Critical :
72
73
if ( WcfEventSource . Instance . EtwUnhandledExceptionIsEnabled ( ) )
73
74
{
74
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
75
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
75
76
WcfEventSource . Instance . EtwUnhandledException ( exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
76
77
}
77
78
break ;
78
79
default :
79
80
if ( WcfEventSource . Instance . ThrowingEtwExceptionVerboseIsEnabled ( ) )
80
81
{
81
- string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , int . MaxValue ) ;
82
+ string serializedException = EtwDiagnosticTrace . ExceptionToTraceString ( exception , MaxExceptionStringLength ) ;
82
83
WcfEventSource . Instance . ThrowingEtwExceptionVerbose ( _eventSourceName , exception != null ? exception . ToString ( ) : string . Empty , serializedException ) ;
83
84
}
84
85
0 commit comments