Closed ThomasArdal closed 1 year ago
Hello, a few questions:
RequestDataAsync
call, does the breakpoint get hit? In other words, does everything work fine until before the RequestDataAsync
call?Microsoft.VisualStudio.DebuggerVisualizers
? Did you add an explicit reference to Newtonsoft.Json
or to some other package?If you want to share your project (make sure not to include any code or information that you wouldn't want to be visible to the public), I would be happy to check it out. Thanks!
Good points. I will provide everything next week.
@matteo-prosperi I have some updates here.
<PackageReference Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.6.1032901" />
One issue that I see is that you are using Visual Studio Version 17.8.0 Preview 1.0 and the SDK is 17.7.19-preview-1.
Because the VisualStudio.Extensibility libraries are in preview and see frequent breaking changes, you should always use the latest Visual Studio preview version (you are good there) and the corresponding version of the SDK that we advertise in this samples repo. Right now the version should be 17.8.13-preview-1
as you can see here.
Hopefully this will help
I just tried upgrading both packages to 17.8.13-preview-1
. Unfortunately, it doesn't make any difference. The error doesn't seem to be related to that package version since I also get the JSON error on the unmodified RegexMatchDebugVisualizer that has the correct version.
I tried using 17.8.13-preview-1
with VS 17.8.0 Preview 1.0 on a clean virtual machine and I was able to build, run and launch the RegexMatchDebugVisualizer.
In my case the project that I was debugging was targeting .NET 8. What is the target framework of the project you are debugging, that is the only variable that I can think of.
The visualizer project is targeting net6.0-windows
and the source project is targeting netstandard2.0
. I think I just copied this from the sample.
I mean what is the target framework of the application that you are debugging when you try to use the visualizer
Oh, good point. It's a net6.0
console app. I just tried creating a new net8.0
console app and my visualizer works 😮 Does this only work with .NET 8?
Debugger visualizers are supposed to work with .NET 6.
I was able to successfully test the sample RegexMatchVisualizer
with net472
, net6.0
and net8.0
. So I can't reproduce your issue yet.
I will tag in @mpeyrotc who works on the debugger side of visualizers.
I just tried it with a clean-from-template net6.0
console app. Everything works fine. So, it must be the console application that I have been testing with that is causing this. I'm suspecting it to include configuration like this that could cause this but not sure:
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Platforms>x64</Platforms>
It's a self-contained console app, so maybe there are some issues there.
Unfortunately, I am still unable to reproduce the issue even with those configuration and setting the project to be a self-contained console app. If you want to share the project that you are debugging, that may help.
Sure. It's this project here: https://github.com/elmahio/Elmah.Io.Cli
I tested with your project and I was able to reproduce the issue.
I think the reason for the error is that your project has an indirect reference on an earlier version of Newtonsoft.Json (10.0.3). tried adding <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
(the version currently used in VS 2022 17.8 Preview 2) and I was able to get a visualizer to work. So my guess is that the debugger is not able to load a newer version of Newtonsoft.Json into the target process because an earlier version is already present.
I agree that this may be an issue considering how widespread usage of Newtonsoft.Json is (and the fact that an updated VS is usually on the very latest version). @mpeyrotc, any idea how to address this?
@ThomasArdal, a workaround for the moment, would be to pin the version of Newtonsoft.Json as I did above.
Makes sense, thank you. I'll update the package. But agree, this is probably something that should be fixed since I'm guessing a lot of people will run into this problem eventually.
As an update, I'm already starting to get error reports on this exact error. And this is with very limited installs and use of my extension. So, this is definitely going to be a problem :smile:
Hello @ThomasArdal, the issue has been fixed and is currently available in VS 17.8 Preview 3. More information can be found in the related VS developer community ticket.
@mpeyrotc As already mentioned in the community ticket the problem is still there in preview 4. I'll follow the community ticket for updates.
I'm playing around with creating a new visualizer and copied most of the code from this sample: https://github.com/microsoft/VSExtensibility/tree/main/New_Extensibility_Model/Samples/RegexMatchDebugVisualizer
When running my code, I get the following error inside my custom XAML view:
I was under the impression that VS automatically loads
Newtonsoft.Json
used in this call:It doesn't help to install that package manually.
What could be the issue here?