Tovich
Tovich

Reputation: 635

C# Suppress MS Fakes warnings

How can I suppress the warnings generated by MS Fakes in a build ? I already edited the XML file to generate only the elements we need, but it’s not enough.

Error message

Cannot generate shim for RestServiceHelper`2+<>c: type is not supported because of internal limitations.

XML sample

<Fakes xmlns="schemas.microsoft.com/fakes/2011/"; Diagnostic="false"> 
  <Assembly Name="Common.Api"/> 
  <StubGeneration> 
    <Clear /> 
  </StubGeneration> 
  <ShimGeneration> 
    <Clear /> 
    <Add FullName="RestServiceHelper" /> 
  </ShimGeneration> 
</Fakes>

I have already read this thread before asking my question: Suppressing Microsoft Fakes warnings

Thanks

Upvotes: 3

Views: 1795

Answers (2)

julealgon
julealgon

Reputation: 8181

The better way to avoid this issue is to use a stricter filter in the XML file. Add a ! character to the end of the filter to use case sensitive precise matching:

  <ShimGeneration> 
    <Clear /> 
    <Add FullName="RestServiceHelper!" /> 
  </ShimGeneration> 

As per the documentation:

enter image description here

Upvotes: 0

Peter Buchmann
Peter Buchmann

Reputation: 177

You can suppress the warning via the following statement:

<Remove TypeName="&lt;&gt;c" />

Upvotes: 2

Related Questions