Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Collections DynamicallyInvokableAttribute IReadOnlyList and IReadOnlyCollection

$
0
0

I have a library that targets .NET 4.0, I have some internal classes that derive from System.Collections.ObjectModel.ReadOnlyCollection<>, I examine the library using reflection and generate a public wrapper that implements the class and all of the public interfaces but does not derive from System.Collections.ObjectModel.ReadOnlyCollection<>.

Using a Windows7 machine with VS2010 I had no issues but on moving to Windows8 and VS2013 my project no longer compiles. On examining the generated code I find that on the Windows8 machine my collections implement two extra interfaces and many properties are attributed with a new attribute.

The two interfaces are IReadOnlyList<> and IReadOnlyCollection<>, my versions of the classes are concrete generics and the compiler compains that the two interface types do not exist in the "System.Collections.Generic" namespace similarly the new attribute __DynamicallyInvokableAttribute results in error CS0246 (the attribute could not be found).

Presumably if I targeted .NET 4.5 the problem would go away but I need to continue support for XP.

Why if my library is supposed to target 4.0 do I get a build that seems to target 4.5?

Is there a way to get around this?

Thank you.



Viewing all articles
Browse latest Browse all 8156


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>