microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.03k stars 399 forks source link

Visual Studio F5 not attaching to netcore FDD deployment mode service #617

Open skwasiborski opened 5 years ago

skwasiborski commented 5 years ago

Setup: Service Fabric version: 6.4.622.9590 SF SDK version: 3.3.622.9590 Visual Studio version 15.9.9 Application containing stateless reliable service targeting netcore 2.1 Service is setup to use framework dependent deployment. I have a simple startup script that starts my service using dotnet.exe like here.

Issue: When the application is started using F5 VS attaches to cmd.exe instead of attaching to dotnet.exe. As far as I understand this is due to how debugging integration with VS is done i.e. SF sends processId of cmd.exe to VS via named Pipe. Is there any way to force SF to send processId of the process that actually called RegisterServiceAsync or work around the problem in other way. I know that i could use FDE deployment mode but this is available only in netcore 2.2. and I need to stay on LTS releases.

skwasiborski commented 5 years ago

Thanks to @mkosieradzki I found IsExternalExecutable="true" attribute on ExeHost In ServiceManifest. This allows to run dotnet.exe directly thus solving the F5 debugging issues i.e. insted of using a script I can now set ExeHost.Program to "dotnet" and ExeHost.Arguments to name of my dll.

It would be great if this would be documented someware in the SF documentation.

oanapl commented 5 years ago

Thank you for the feedback, @skwasiborski . The flag is documented here. Like you said, we could improve our conceptual documentation around this - @gkhanna79 , can you follow up on that?