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

Debugging VSIX unhandled errors #14

Closed
VorTechS opened this Issue Dec 19, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@VorTechS

VorTechS commented Dec 19, 2017

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?

@VorTechS VorTechS changed the title from Debugging VSIX un-handled errors to Debugging VSIX unhandled errors Dec 19, 2017

@csharpfritz

This comment has been minimized.

Show comment
Hide comment
@csharpfritz

csharpfritz Dec 20, 2017

Owner

Answered on the Dec. 19, 2017 stream. Link to come to the video. about 35 minutes in...

Owner

csharpfritz commented Dec 20, 2017

Answered on the Dec. 19, 2017 stream. Link to come to the video. about 35 minutes in...

@VorTechS

This comment has been minimized.

Show comment
Hide comment
@VorTechS

VorTechS Dec 20, 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!

Many thanks!

VorTechS commented Dec 20, 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!

Many thanks!

@VorTechS VorTechS closed this Dec 20, 2017

@VorTechS VorTechS reopened this Dec 20, 2017

@VorTechS

This comment has been minimized.

Show comment
Hide comment
@VorTechS

VorTechS Dec 20, 2017

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?

VorTechS commented Dec 20, 2017

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?

@csharpfritz

This comment has been minimized.

Show comment
Hide comment
@csharpfritz

csharpfritz Dec 20, 2017

Owner

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

Owner

csharpfritz commented Dec 20, 2017

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

@csharpfritz csharpfritz reopened this Dec 20, 2017

@VorTechS

This comment has been minimized.

Show comment
Hide comment
@VorTechS

VorTechS Jan 8, 2018

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)

VorTechS commented Jan 8, 2018

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment