minicover icon indicating copy to clipboard operation
minicover copied to clipboard

Getting `System.IO.FileNotFoundException` for .pdb

Open 64J0 opened this issue 1 year ago • 1 comments

Description:

Hello, hope you're good. I'm opening this issue to ask for guidance on how to deal with this error:

# the command I used:
dotnet minicover instrument --workdir ./ --sources "source/**/*.fs" --exclude-sources "source/Tests/*.fs" --tests "source/Tests/*.fs"

#...
# logs checking assembly files, and assembly instrumented in the end
# ...
Unhandled exception. System.IO.FileNotFoundException: Could not find file '/tmp/minicover/fff1ada6-53fe-4c90-866c-b19e821421b3.pdb'.
File name: '/tmp/minicover/fff1ada6-53fe-4c90-866c-b19e821421b3.pdb'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at System.IO.Abstractions.FileWrapper.Copy(String sourceFileName, String destFileName, Boolean overwrite)
   at MiniCover.Core.Instrumentation.Instrumenter.VisitAssemblyGroup(IInstrumentationContext context, InstrumentationResult result, IReadOnlyCollection`1 assemblyFiles) in /home/vsts/work/1/s/src/MiniCover.Core/Instrumentation/Instrumenter.cs:line 125
   at MiniCover.Core.Instrumentation.Instrumenter.Instrument(IInstrumentationContext context) in /home/vsts/work/1/s/src/MiniCover.Core/Instrumentation/Instrumenter.cs:line 58
   at MiniCover.Commands.InstrumentCommand.Execute() in /home/vsts/work/1/s/src/MiniCover/CommandLine/Commands/InstrumentCommand.cs:line 100
   at MiniCover.Program.<>c__DisplayClass0_2.<Main>b__3() in /home/vsts/work/1/s/src/MiniCover/Program.cs:line 51
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass79_0.<OnExecute>b__0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at MiniCover.Program.Main(String[] args) in /home/vsts/work/1/s/src/MiniCover/Program.cs:line 73

And when I check what is inside the /tmp/minicover/ folder, I get:

ls /tmp/minicover/

abe3cbba-b9af-4155-a154-3679166f6d9f.dll  
fff1ada6-53fe-4c90-866c-b19e821421b3.dll

So, no .pdb was generated.

Also, I'm using minicover version 3.6.1.

64J0 avatar Aug 07 '23 19:08 64J0

It worked after removing the --exclude-sources "source/Tests/*.fs"

64J0 avatar Aug 08 '23 13:08 64J0