Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
821 views
in Technique[技术] by (71.8m points)

visual studio 2013 - Suppressing Microsoft Fakes warnings

I'm using Microsoft Fakes to shim a couple WindowsAzure components for testing. Following the advice in vs 2012: Shims compile, I updated my .fakes file to just generate the shims I actually need:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/" Diagnostic="false">
  <Assembly Name="Microsoft.WindowsAzure.Storage" Version="2.1.0.0"/>
  <StubGeneration>
    <Clear/>
  </StubGeneration>
  <ShimGeneration>
    <Clear/>
    <Add FullName="Microsoft.WindowsAzure.Storage.CloudStorageAccount"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient"/>
    <Add FullName="Microsoft.WindowsAzure.Storage.Queue.CloudQueue"/>
  </ShimGeneration>
</Fakes>

But I'm still getting the "Some fakes could not be generated..." warning. All the specified shims are being generated, and commenting any of those above lines out causes my test project to fail to build. If I turn on diagnostics, I see dozens of messages like:

Warning 2   Cannot generate shim for Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient+<>c__DisplayClass1: type is not supported because of internal limitations.

Everything works, I just want to suppress the warning so it stops confusing our CI server. Is there a warning number for the non-diagnostic message I can just stick in the test project to ignore?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can remove types from the shimgeneration using

<Remove TypeName="c__DisplayClass" />

That will remove out all the types containing the above string.

See msdn link


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...