-
Notifications
You must be signed in to change notification settings - Fork 4k
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
VSIX based analyzers don't work on adding a VSPackage item (.pkgdef) to VSIX project (VS2015 RTM) #7008
Comments
To @mavasani |
@BrianBergh Thanks a lot for filing the issue. I am going to verify your scenario on the latest Update1 bits and post an update here. |
Should be fixed, @DustinCampbell already saw this here DustinCampbell/CSharpEssentials#38 (comment) |
@Suchiman There are couple of issues mentioned here:
#2 was fixed by #6285 as you noted. This issue tracks investigating #1 - I'll modify the title accordingly. |
@BrianBergh I investigated this further and confirmed that issue 1. repros on VS2015 RTM and VS2015 Update1 RTM. Below are the simple repro steps:
Got: Options grid throws a package load failure dialog and doesn't work.
Root Cause: The name of the analyzer project is same as the name of the VSIX project (Analyzer1). Details: When you add a pkgdef to your VSIX project, the VSIX project packages it in an assembly with the same name as the VSIX project. Now the pkgdef assembly and referenced analyzer assembly have the same name, causing only one of them to be packaged in the VSIX and hence both don't work. Workaround: Right click on VSIX project => Project properties => Change "Assembly Name" of the VSIX to something else and repeat step 4 above. Both analyzer and options grid should work in VS2015 Update1 RTM. We should fix our Analyzer + CodeFix template project to use different names for the VSIX project and analyzer project, so users don't run into this. Assigning it to @jmarolf to fix. |
@mavasani |
After updating to RC1, create a new "Analyzer with Code Fix (NuGet + VSIX) project".
Create a simple OptionsPackage class (:Package) by adding a VSPackage item to the VSIX project.
Bonus info regarding RC1 (this bug also exists in the pre-RC)
In the RC1, i actually get this, when i try to add a VSPackage:
It doesn't matter if you choose the UserControl method, or if you use the build-in property converter method.
In this sample, i've added a usercontrol.
These are the VSIX properties:
Now, if you press F5 (or at least when i do), i get this error (from the VSPackage):
Resulting in this error in the log:
444
2015/11/23 20:17:32.463
Error
80131522
Could not load type 'CCop.CCopOptionsPackage' from assembly 'CCop, Version=1.0.5805.38057, Culture=neutral, PublicKeyToken=3058d244428cca12'.
Now, when I continue, I can see, that the analyzers doesn't work. I don't get any exceptions, but it seems like if the analyzers aren't even invoked at all.
So, no analyzers, and no options :/
Now, stop debugging.
Try disabling the VSIX property "Include assembly in VSIX container"
Now, F5 to debug again.
Still the same error dialog, and still no analyzers working (nor any options).
Even if i set all properties to false, I still can't make the analyzers work.
Now, try installing the VSIX package manually from the bin/debug folder:
At this point, the analyzers worked in VS2015 RTM, but still no luck in the Update 1 RC1.
Now, the options works (no error dialogs), but the analyzers still won't work:
Bonus info: I get this warning:
This is what the folder looks like:
I have no clue what dependency it talks about, as the VSIX installer should include any dependencies, but it seems that it doesn't.
Back to VS, i try to set all properties in the VSIX package to false:
I get the same result.
But, if i reference the Analyzer project output dll manually into my test project (Consoleapp), the analyzers gets invokes, and works great.
But i still get an odd warning at the bottom (from the VSIX package) that it can't find the referenced assembly?
The text was updated successfully, but these errors were encountered: