-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
NullReferenceException when composing the CSharp.Features assembly #11841
Comments
Also affects the master branch, I'm running into this when trying to consume new CompletionService API. |
So, unless I'm missing something, this is a bug in MEF that has been fixed by @aelij (nice!) and Roslyn just needs to pick up a new System.Composition. Is that correct? |
Yes, thats what its looking like currently. No idea if there are new nuget packages available for MEF yet. |
Hmmm... I'm trying to understand why I this was working for me in OmniSharp where I successful composed the Features assemblies. It looks like we're using Microsoft.Composition, 1.0.27 in Roslyn and OmniSharp is using Microsoft.Composition, 1.0.30. If you reference 1.0.30 in your app, does that address the problem? |
1.0.30 doesn't seem to make a difference. I'm using code similar to the original post to load the assemblies, and Roslyn is compiled from master instead of using nuget packages. |
Hmmm... OK. The other big difference is that OmniSharp is using the 1.3.0 Roslyn packages rather than 2.0.0. @stephentoub, @dsplaisted -- this looks related to dotnet/corefx#6605. Has that made it into any official NuGet package yet? It looks like the last Microsoft.Composition release was 1.0.30, which is a year and a half ago. |
@mellinoe has a PR adding packages for System.Composition.* here: |
OK. So, this is in flux at the moment. @tmat, you're our portability guru, right? 😄 Any thoughts? Looking at GenerateMethodCodeFixProvider, it seems like having multiple |
GenerateMethodCodeFixProvider seems to be the only one preventing MEF to load the assembly. Merging both attributes into one and recompiling CSharp.Features allows MEF to load it 👍 |
I see one other but it's in the Editor Features layer. I also see others that have combined the Before and After values, so I'm confident there's not some underlying bug. Feel like submitting a PR @weltkante? |
I can try making one, not very fluent with github yet. |
@weltkante's PR has been merged, which should workaround this issue for the Features layer. |
we should have a test that successfully composes the features layer into an AdHocWorkspace. |
You're right. We should. I'll do that. |
Cool :) |
Issue dotnet#11841 found that, due to a MEF bug, the Features assemblies could not properly be included in a MEF composition. This was worked around by combining [ExtensionOrder] attributes where multiple attributes had been specified. This change adds a tests for C# and VB to ensure that a CompletionService can be acquired from an AdhocWorkspace that is created with MefHostServices that include the Features assemblies. I verified that these tests fail without the workaound described above, and pass with the workaround in place.
Version Used: 2.0.0-beta1-20160603-02
Steps to Reproduce:
CSharp.Features
assembly:Expected Behavior:
No exception
Actual Behavior:
Note that this is probably related to this PR: dotnet/corefx#6605
For example,
GenerateMethodCodeFixProvider
has twoExtensionOrder
attributes.Workaround:
Skip
ExtensionOrder
attributes:The text was updated successfully, but these errors were encountered: