Open BuddhaBuddy1 opened 5 years ago
@ravipal , you said in the original post that it worked for you. Can you post your code, and the version of the Service Fabric SDK you used?
@BuddhaBuddy1 Can you catch the exception and post the stack trace here ? This would be a general eventsource issue and not service fabric specific. Right ?
I was facing the same problem and saw this issue here. This is the stack trace of the exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(Int32 eventId, Guid* relatedActivityId, Int32 eventDataCount, EventData* data)
at System.Diagnostics.Tracing.EventSource.WriteEvent(Int32 eventId, Int32 arg1, String arg2)
at SharedLibrary.BaseServiceEventSource.ServiceTypeRegistered(Int32 hostProcessId, String serviceType) in C:\Users\Rogier\source\repos\ServiceFabricCommonLibrary\SharedLibrary\BaseServiceEventSource.cs:line 117
at Service2.Program.Main() in C:\Users\Rogier\source\repos\ServiceFabricCommonLibrary\Service2\Program.cs:line 27
And the issue can be easily recreated by the example in the introduction post.
Anything? I am also having this same issue..
I think this is less an SF and more an ETW weirdness issue.
We've "solved" this by not using a base class. Instead we put one generic event source (LogDebug, LogError etc.) including the ETW attributes into the library. Since service type names etc. are logged into the events, you can then query by those to differentiate the output by service.
This is a repost of https://github.com/Azure/service-fabric-issues/issues/473, which was closed because the original poster was away and didn't respond until after it was closed. However, I am having the same issue. I want to abstract out ServiceEventSource to a base class in a library, but when I do I get a System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' on the ServiceRegistered call. It doesn't matter if it is in a library or a separate class in the same namespace.
StatefullService1.ServiceEventSource.cs
SharedLibrary.BaseServiceEventSource.cs