-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add support for internal metadata view interfaces #10
Conversation
@AArnott, |
@davkean Did you want this before 15.6? |
@AArnott No hurry, 15.6 is fine. Thanks for doing this! |
private TypeInfo EmitMagicAttribute() | ||
{ | ||
var tb = this.moduleBuilder.DefineType( | ||
"System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there docs for this attribute? I haven't heard of it before, but it definitely seems to come in handy here. I'm assuming that this attribute is supported in .NET 4.5, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not documented on MSDN. It is in CoreCLR and .NET Framework, although I'm not sure which version started supporting it. If vs-mef runs on a version that doesn't support it, it will just be ignored and we'll "regress" to behavior before this PR. This PR won't make anything worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened a bug to get the attribute documented: Bug 438899: Document IgnoresAccessChecksToAttribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.NET 4.6 added support for this attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay - that should be fine in VS since we require .NET 4.6. I was initially worried about the situations where we launch devenv /updateConfiguration
when only .NET 4.5 is installed - this can happen if we're pending reboot to install .NET 4.6. However, I just remember this was "fixed" in 15.2, though, by avoiding composing MEF in the cases where .NET 4.6 is not installed (DevDiv PR 66331). The next launch of VS will do the composition in that case.
Dang, this adds 22 more test failures on Mono :( |
Odd, unless all those tests are the new ones I added for the feature. I didn't expect any regressions. |
Not sure if this stack will provoke any insights:
|
That is a MEFv1 failure (i.o.w. mono's MEF implementation has a bug). It looks like mono MEF can't handle RefEmit of a type that implements an internal interface in another assembly very well. As in, RefEmit crashes badly. |
This gives VS MEF the ability to generate metadata view dynamic types that derive from internal interfaces. .NET MEF and NuGet MEF don't have this capability, but it is achievable using the CLR's assembly attribute that tells it to disregard visibility checks.
Closes #9