Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Debugging VSIX unhandled errors #14
I've been working on a VSIX with Visual Studio 2015 and whilst the new extension installs, when the related window is activated an error occurs which simply reads:
'Exception has been thrown by the target of an invocation'
This might actually be an error from the source code itself, or it might have been raised by Visual Studio.
What's the best way to debug this kind of problem? I couldn't see anything in Event Viewer, but are there any logs out there I could be looking into?
Are we able to attach a VS debugger with the source code of the extension to the Visual Studio Instance we're launching the window in to perform a step-through?
changed the title from
Debugging VSIX un-handled errors
Debugging VSIX unhandled errors
Dec 19, 2017
Thanks for the answer on the stream Jeff! (I caught up with it bright and early this morning)
I guess my problem runs a little deeper, as I cannot start Visual Studio attached directly to my project the way you did. When I 'Run' my project, I just get 'A project type with an output type of Class Library cannot be started directly'.
Ignoring the automatic launching issue, you basically confirmed that I could just 'Debug -> Attach to Process' and sure enough I get a breakpoint on my un-handled exception!
Okay, so. I worked out that I had to set the 'External Program' on startup to Visual Studio, and add the command line to set the Visual Studio Experimental Instance. And now I can debug from the project directly.
However, now I'm getting a 'different' error message than if I manually install the VSIX and attach the debugger. Both relate to loading a 3rd party assembly.
In the 'debugged from F5 instance', I get 'Failed to load assembly, the file could not be found'.
In the 'attached after installing from VSIX instance', I get an error about needing to strongly name the assemblies. I worked through this last issue myself, and now the new extension is loading correctly.
But, how come VS isn't finding the 3rd party assemblies when launching the experimental instance?
Summarized in blog post: http://jeffreyfritz.com/2017/12/asp-net-core-with-docker-and-a-private-registry-on-azure/
Let's get together on stream and review your scenario
In the first steps to making the extension open source, I create a new solution in a new git repo, copied and pasted the project and then 'added' the copied project to the new solution. This seems to do the trick, and I'm able to debug in the experimental instance now.
(Issue left open so you can comment as appropriate)