nohwnd/Profiler

Export fails with Newtonsoft error

instinct-vfx opened this issue · 4 comments

When adding the -ExportPath parameter i get the following error:

Exporting report into speedscope format.MethodInvocationException: C:\Users\*****\Documents\PowerShell\Modules\Profiler\4.0.0\Export-SpeedScope.ps1:37
Line |
  37 |          $destination = [Profiler.SpeedScope.SpeedScope]::Export($expo …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Export" with "4" argument(s): "Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. Could not find or load a
     | specific file. (0x80131621)"
    

Profiler brings the dependency together, can you confirm you see it in your profile?

image

Which version of powershell are you using?

Did you install the module via Install-Module or manually?

Has been a while trying. Will try to replicate and check the dependency. I did use Install-Module. PowerShell version is 7.1.3

Strange. I am looking at the contents of the shipped module Profiler 4.0.0. All the dlls come from the actual build, I am not doing anything special there. I let nuget restore them, and msbuild to build the solution and then I just copy a subset of the final build result. So there should be very little margin for error.

All the version numbers agree etc.

Maybe there are 2 things to try:

  • load older (12 or less) version of newtonsoft to powreshell before you try running it, maybe it simply cannot load a second version of the same assembly. I see the error code above referenced in few places, and they mention that the error happens only when they loaded some other module before the action.
  • try deleting the file in your module directory, maybe antivirus ate/blocked it.

I am totally overwhelmed at work this week. Will try and look into it again and check.