runtime: Add UnmanagedCallersOnly constructor that takes a single type (UnmanagedCallersOnly is not CLSCompliant)
When trying to use [UnamangedCallersOnly(CallConvs = new Type[] { typeof(CallConvStdcall) })] in a CLSCompliant assembly (CoreLib…) I’m getting this warning from Roslyn:
CS3016 Arrays as attribute arguments is not CLS-compliant
This warning is also emitted if the attributed thing is marked internal or private. I’m unclear why this would matter.
Filing this issue in the runtime repo since this is where the attribute is but we might want to move to Roslyn.
On an unrelated note - why is this an array in the first place?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 15 (13 by maintainers)
Actually, I think any runtime updates would be a lot more involved than my initial reaction. We’re only looking at named arguments right now, so we don’t have to deal with parsing potentially different constructors at all. Updating to be able to do that seems non-trivial.