I am working on a Service Fabric application that contains several stateless services and a single state service. When I publish for the first time, everything is fine, and it deploys in my local cluster. After that, if I try to package or publish the application without an explicit stop first, I get the following error:
CSC: CS2012 error: cannot open "C: ... \ ProjectFolder \ obj \ x64 \ Debug \ ProjectName.pdb" for writing - "The process cannot access the file" C: ... \ ProjectFolder \ obj \ x64 \ Debug \ ProjectName.pdb 'because it is being used by another process.
According to the process explorer , PDB is blocked by my own ProjectName.exe. This is the only state service in my application.
- Why is my exe blocking my own PDBs? I could understand if this was Visual Studio.
- I don’t see anything in my own code that should cause this, so I am assuming something in the Fabric code that I call.
- PDBs are deployed with the application, but files in the source source directory that are locked - why not the PDB next to the running code?
- Why do I see only this error related to the state service, and not stateless services?
- I suspect this has something to do with the state service that generates a lot of errors on startup, for which Fabric may need characters to display correctly.
- How can I stop this: either use the correct PDBs or not use them at all if I am not debugging Visual Studio?
Edit: raised on github . Current workaround for this:
The current workaround at this point in time will be to restrict network service access to pdb in the build folder (obj \ x64 \ Debug).
source share