An unhandled exception occurred for the trace session 'Microsoft-SemanticLogging-Etw-sqlSink'. System.Exception: Reading past end of event

Topics: Semantic Logging Application Block
May 12, 2013 at 9:23 AM
Edited May 12, 2013 at 9:24 AM
I'm working with SLAB for the first time. I've created an EventSource which was working. I've added a bunch more events and now I'm receiving this when I run the app:
ProviderId : d1ed7ec7-5701-5554-2c5e-796dc42511c5
EventId : 800
Keywords : 4
Level : Error
Message : An unhandled exception occurred for the trace session 'Microsoft-SemanticLogging-Etw-sqlSink'. Message: System.Exception: Reading past end of event
   at Diagnostics.Tracing.TraceEvent.GetUnicodeStringAt(Int32 offset) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\TraceEvent1.2.7\TraceEvent.cs:line 1111
   at Diagnostics.Tracing.Parsers.DynamicTraceEventData.PayloadValue(Int32 index) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\TraceEvent1.2.7\DynamicTraceEventParser.cs:line 786
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.CreatePayload(TraceEvent traceEvent) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 198
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.CreateEventEntry(TraceEvent traceEvent) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 184
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.ProcessEvent(TraceEvent evt) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 149
Opcode : Info
Task : 64734
Version : 0
Payload : [sessionName : Microsoft-SemanticLogging-Etw-sqlSink] [message : System.Exception: Reading past end of event
   at Diagnostics.Tracing.TraceEvent.GetUnicodeStringAt(Int32 offset) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\TraceEvent1.2.7\TraceEvent.cs:line 1111
   at Diagnostics.Tracing.Parsers.DynamicTraceEventData.PayloadValue(Int32 index) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\TraceEvent1.2.7\DynamicTraceEventParser.cs:line 786
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.CreatePayload(TraceEvent traceEvent) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 198
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.CreateEventEntry(TraceEvent traceEvent) in c:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 184
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.TraceEventServiceWorker.ProcessEvent(TraceEvent evt) inc:\Builds\40\EntLib\ELV6-Blocks-NuGet\src\Source\Blocks\SemanticLogging\Src\SemanticLogging.Etw\TraceEventServiceWorker.cs:line 149]
EventName : TraceEventServiceSinkUnhandledFaultInfo
Timestamp : 2013-05-12T07:33:39.2778135Z
What is the 'end' of the event past which it tried to read?
May 12, 2013 at 10:54 AM
I forgot to include the Event method's parameter in the call to WriteEvent. When I did, the exception went away.
May 12, 2013 at 3:27 PM
I agree that the error is quite cryptic since it gives no clue on where is the actual error. For this case and in general, there is a helper class included in the SemanticLogging assembly "EventSourceAnalyzer" that it may help you out for checking many potential issues in a custom EventSource. You can find further details here in my post.