Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Could not load System.Runtime or one of its dependencies" #112

Closed
zspitz opened this issue May 21, 2020 · 5 comments
Closed

"Could not load System.Runtime or one of its dependencies" #112

zspitz opened this issue May 21, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@zspitz
Copy link
Owner

zspitz commented May 21, 2020

Describe the bug
When trying to open the visualizer from the visualizer dropdown, VS presents the following error:

Unable to load the custom visualizer
Could not load file or assembly 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. An attempt was made to load a program with an incorrect format.

image

To Reproduce
Steps to reproduce the behavior:

  1. Open a .NET Core project (any version, it seems)
  2. Set a breakpoint within the code
  3. When the debugger reaches the breakpoint, try to open the visualizer on a variable which points to an Expression -- either in a tooltip from the main editor window, or from the Locals, Autos, or Watch panes.

Expected behavior
The visualizer should load.

Version info:

  • Visual Studio version: 2019
  • Visualizer location: Documents subfolder
  • Version: [GitHub release version or project commit]

Note that the visualizer location and version can be found at the bottom of the Settings popup (click the gear icon).

Workarounds

  • Either put the DLLs into the Visual Studio install path, OR
  • Disable Costura on the debugger and rebuild.

Additional context
The issue only comes up if Costura is used to compile everything into a single file. It's important to use Costura, because that means only a single DLL is copied/pasted; otherwise all the dependent DLLs need to be in the Visualizers subfolder, and also in each framework-specific subfolder. The chances of broken dependencies increase exponentially.

Taking Costura off of the debugger-side DLL doesn't appear to help.

Previous instances: #110 #103

(NB This issue should not be closed until we've verified that it's been resolved completely.)

@zspitz zspitz added bug Something isn't working visualizer ui and removed visualizer ui labels May 21, 2020
@zspitz
Copy link
Owner Author

zspitz commented May 24, 2020

I tried using Fuslogvw without success; the log viewer was set to log binding errors.

I tried the following steps:

  1. Start Visual Studio
  2. Delete all entries in the log viewer.
  3. Run the .NET Core debug targeted app with a breakpoint.
  4. Attempt to open the visualizer; I get the above error.

After all this. there are four binding errors, none of which seem to be relevant.

@zspitz
Copy link
Owner Author

zspitz commented May 24, 2020

I tried to figure out which DLL is causing the problem, by disabling Costura so all DLLs are output to the visualizers folder, and renaming all the DLLs except the main visualizer so they couldn't be found. Then I tried to successively restore the correct name for each DLL.

I was able to trace the error specifically to the Periscope DLL.

My understanding of the problem is that .NET Framework uses one version of System.Runtime while .NET Core uses another. And we have an indirect reference to .NET Core: ExpressionTreeVisualizer.dll -> Periscope.dll -> Periscope.Debuggee.dll (which targets .NET Standard, ,NET Framework and .NET Core). But that isn't supported by what's happening -- Periscope.dll should load fine and an error should be raised after trying to load Periscope.Debuggee.dll.

@zspitz
Copy link
Owner Author

zspitz commented May 24, 2020

Updating the Periscope.Debuggee.dll library to target .NET Framework 4.7.2 (instead of .NET Framework 2.0) doesn't help.

@zspitz
Copy link
Owner Author

zspitz commented May 24, 2020

(Closed by mistake.)

@zspitz
Copy link
Owner Author

zspitz commented Jun 11, 2020

Periscope and Periscope.Debuggee are now submodules. We are no longer using Costura to create a single DLL. Instead, all the dependencies are in a subfolder of the primary DLL, and loaded by Periscope by listening to the AssemblyResolve event.

Uninstalling will be a bit more painful -- delete all the files in the visualizer folder which start with ExpressionTreeVisualizer, or are in a subfolder named so.

@zspitz zspitz closed this as completed Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant