Hopefully this is simple...
I want to performance profile my service fabric cluster.
So far I: - Go to Start Diagnostics tools without debugging. - Go through the wizard selecting my service fabric project as the startup project. - Then it asks which projects to include, so I include my service exe - Then I select instrumentation (I want method level timing)
Then I hit start and immediately my exe crashes. I assume this is because visual studio is trying to run my "service" outside of the service fabric context as a standalone exe.
Not sure what to do about that though...
The stack trace is:
DEBUG: Activating options
Unhandled Exception: System.Fabric.FabricConnectionDeniedException: Not authorized to connect ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C43 at System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context) at System.Fabric.FabricRuntime.NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context) at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Thanks for the help in advance!
What you're seeing is Visual Studio attempting to start your service host process on its own outside of the Service Fabric runtime. Normally, when you run a service through Visual Studio, you deploy the application project, which goes through the process of registering and instantiating your services on your local Service Fabric cluster.
Instrumentation currently doesn't work out-of-the-box with Service Fabric projects for this reason. We're looking at ways to make this possible in the future.
You can still do Sampling profiling, which allows you to attach the profiler to a running EXE. In that case, you'd deploy your application normally first, then attach the profiler to your service EXEs.