Search code examples
c#.netperformance-testingcrank

System.AggregateException: One or more errors occurred. (End of Central Directory record could not be found.)


Regarding dot net crank, I am getting this error when trying to run the previously working cloned repository code without making any changes.


[01:39:29.124] An unexpected error occurred while building the job. System.AggregateException: One or more errors occurred. (End of Central Directory record could not be found.)

 ---> System.IO.InvalidDataException: End of Central Directory record could not be found.
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at System.IO.Compression.ZipFile.Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding)
   at System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding, Boolean overwriteFiles)
   at Microsoft.Crank.Agent.Startup.CloneRestoreAndBuild(String path, Job job, String dotnetHome, CancellationToken cancellationToken) in /_/src/Microsoft.Crank.Agent/Startup.cs:line 2368
   at Microsoft.Crank.Agent.Startup.<>c__DisplayClass62_3.<<ProcessJobs>b__17>d.MoveNext() in /_/src/Microsoft.Crank.Agent/Startup.cs:line 775

   --- End of inner exception stack trace ---

[01:39:29.129] Starting -> Failed (application:2)
[01:39:29.130] Error starting job 'application' (2): System.IO.InvalidDataException: End of Central Directory record could not be found.
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at System.IO.Compression.ZipFile.Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding)
   at System.IO.Compression.ZipFile.ExtractToDirectory(String sourceArchiveFileName, String destinationDirectoryName, Encoding entryNameEncoding, Boolean overwriteFiles)
   at Microsoft.Crank.Agent.Startup.CloneRestoreAndBuild(String path, Job job, String dotnetHome, CancellationToken cancellationToken) in /_/src/Microsoft.Crank.Agent/Startup.cs:line 2368
   at Microsoft.Crank.Agent.Startup.<>c__DisplayClass62_3.<<ProcessJobs>b__17>d.MoveNext() in /_/src/Microsoft.Crank.Agent/Startup.cs:line 775
--- End of stack trace from previous location ---
   at Microsoft.Crank.Agent.Startup.ProcessJobs(String hostname, String dockerHostname, CancellationToken cancellationToken) in /_/src/Microsoft.Crank.Agent/Startup.cs:line 837
[01:39:29.132] Processing job 'application' (2) in state Failed
[01:39:29.572] Driver stopping job '2'
[01:39:30.138] Processing job 'application' (2) in state Failed

Solution

  • Reinstalling the crank and crank-agent packages resolved this error.

    Another error that I faced when trying to uninstall the package was it was saying I do not have permission to access the location where the package file was. And the reason being crank-agent was running in one of the PowerShell terminal windows. After stopping the crank-agent and I could run the uninstalling command.

    To uninstall run below commands:

    • dotnet tool uninstall microsoft.crank.controller -g

    • dotnet tool uninstall microsoft.crank.agent -g