EtwDiagnosticTrace throw exception if fault message contains certain Unicode characters
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 576
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
A returned fault containing a record separator () causes an exception in EtwDiagnosticTrace.ExceptionToTraceString(), which hides the fault from the client.
**To Reproduce**
Call a wcf service that returns a fault with a message containing a record separator. Instead of the fault an InvalidOperationException is thrown:
```
System.InvalidOperationException: The Writer is closed or in error state.
at System.Xml.XmlWellFormedWriter.AdvanceState(Token token)
at System.Xml.XmlWellFormedWriter.WriteEndElement()
at System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlWriter xml, Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(Exception exception, Int32 maxTraceStringLength)
at System.Runtime.ExceptionTrace.TraceEtwException(Exception exception, EventLevel eventLevel)
at System.ServiceModel.Diagnostics.ExceptionUtility.ThrowHelper(Exception exception, EventLevel eventLevel)
at System.ServiceModel.Diagnostics.ExceptionUtility.ThrowHelperWarning(Exception exception)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.b__0(IAsyncResult asyncResult)
```
**Expected behavior**
A FaultException based on the returned fault is thrown.
**Additional context**
The same faults can be processed without any problem in .NET48
Contributor guide
Assessment
This issue has not been assessed yet.