简体   繁体   中英

Referenced Code not executing in Visual Studio Extension

I have a Visual Studio Extension (VSIX package) that shows a WinForms dialog and then returns a string that is inserted into the code editor window in VS.

The WinForm loads fine. I can return a hard coded string and VS puts it into the editor. However, if the WinForm makes a call to a 3rd party library (it is a .Net Core class library) it stops execution without an exception I can see and closes the form out. To test further, I had the referenced library simply return a hard coded string so there wasn't risk of an Exception in that code and it failed it (which makes me believe it's the action of calling the library.. if I step through this with a debugger it will not execute a procedure that makes a called to the referenced library.. if I comment out that line it will step through that procedure). If I pluck the form out and put it in a WinForms app it executes as expected.

The referenced library was loaded into the extension via a local NuGet feed.

  1. The 3rd party library isn't signed currently, could that be the issue?
  2. The 3rd party library is a "Class Library (.Net Core)".. there's no option I can see through the GUI to sign the library like you can with traditional class libraries (although this targets .Net 4.6). The WinForm itself can call it if it's in a different solution, it barfs when run through the VS Extension.
  3. What else could cause this problem?

Side note, this is an extension for myself and not general distribution.

Will post this for posterity. Visual Studio appears stop the execution of the code in the extension when it makes a call out to an unsigned assembly. I tested this by signing the 3rd party assemblies (it then worked). The VSIX also signs itself by default if you use the template to create that project in Visual Studio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM