0

I have a really annoying issue with service fabric where I am now getting a file in use error

This makes no sense because I have reset the cluster, rebooted, etc and nothing works

The problem is that the message is useless

    12>powershell -NonInteractive -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -Command ". 'PATH\Scripts\Deploy-FabricApplication.ps1' -ApplicationPackagePath 'PATH\pkg\Debug' -PublishProfileFile 'PATH\PublishProfiles\Local.5Node.xml' -DeployOnly:$true -ApplicationParameter:@{} -UnregisterUnusedApplicationVersionsAfterUpgrade $false -OverrideUpgradeBehavior 'None' -OverwriteBehavior 'Always' -SkipPackageValidation:$true -ErrorAction Stop"
12>Copying application to image store...
12>Upload to Image Store succeeded
12>Registering application type...
12>Register-ServiceFabricApplicationType : One or more errors occurred. --> AggregateException: One or more errors 
12>occurred. --> FileLoadException: The process cannot access the file because it is being used by another process. 
12>(Exception from HRESULT: 0x80070020)
12>At C:\Program Files\Microsoft SDKs\Service 
12>Fabric\Tools\PSModule\ServiceFabricSDK\Publish-NewServiceFabricApplication.ps1:251 char:9
12>+         Register-ServiceFabricApplicationType -ApplicationPathInImage ...
12>+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12>    + CategoryInfo          : InvalidOperation: (Microsoft.Servi...usterConnection:ClusterConnection) [Register-Servic 
12>   eFabricApplicationType], FabricException
12>    + FullyQualifiedErrorId : RegisterApplicationTypeErrorId,Microsoft.ServiceFabric.Powershell.RegisterApplicationTyp 
12>   e
12> 
12>Finished executing script 'Deploy-FabricApplication.ps1'.
12>Time elapsed: 00:00:45.6667428
12>The PowerShell script failed to execute.

How can I get more information about the exact file that is in use?

I am trying to deploy into a dev cluster

Cheers

Paul

Paul
  • 2,773
  • 7
  • 41
  • 96
  • Usually you get this kind of exception if you forget to properly Dispose of the File Handles. FileHandles a prime example for stuff you should use the using directive for (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive). Splitting up the creation and disposing of a Reference is only asking for trouble. Creation, use and Dispose should be contained into one piece of code. Rather change the structure to conform to this, then trying to go another path. – Christopher Mar 21 '18 at 18:16
  • I just removed the path for privacy reasons the path is ok – Paul Mar 21 '18 at 18:18
  • That response makes no sense. – Christopher Mar 21 '18 at 18:28
  • Get-SmbOpenFiles (remote) or check with sysinternals process explorer for the path (local) – dsdel Mar 21 '18 at 20:08
  • Ok I am using sys internals it’s so annoying to not see the filename lol – Paul Mar 21 '18 at 20:08

1 Answers1

0

This appears to have been caused by Trend real time scanner!

Paul
  • 2,773
  • 7
  • 41
  • 96