1

I'm trying to create a shim for System.Net.Sockets.SocketAsyncEventArgs but have been unable to get VS to create the shim.

Here is my current System.fakes file:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/" Diagnostic="true">
  <Assembly Name="System" Version="4.0.0.0"/>
  <ShimGeneration>
    <Clear/>
    <Add FullName="System.Net.Sockets.SocketAsyncEventArgs"/>
  </ShimGeneration>
</Fakes>

This gives the following error:

'System.Net.Sockets.SocketClientAccessPolicyProtocol' is obsolete:

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Is there a way to shim a class that has the Obsolete["Message", IsError = True] attribute set?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Matt Klein
  • 7,856
  • 6
  • 45
  • 46
  • MS Fakes cannot create a Shim for every type. Check out this question for more info about the `Diagnostic` attribute, and how it could help you determine what the problem is: http://stackoverflow.com/questions/14067332/vs-2012-shims-compile/14073894#14073894 – Jason Evans May 01 '14 at 21:16
  • Thanks @JasonEvans that link had me turn on the "Diagnostic" and look at the warnings, which lead me to see that the class has a property with the `Obsolete["...",IsError=True]` attribute set, which was blocking the Fakes framework from creating the shim. I've updated my question to better reflect the situation. – Matt Klein May 01 '14 at 21:44

0 Answers0