none
errors on trying to "Add Fakes Assembly" on System

    Question

  • I am following the Microsoft Fakes tutorial about shims on https://msdn.microsoft.com/en-us/library/hh549176.aspx, but stuck at the very beginning, where it says to right-click on the "System" in the References, and click "Add Fakes Assembly". Here is the errors from output:

    1>------ Build started: Project: AccountsTest, Configuration: Debug Any CPU ------
    1>C:\temp\AccountsTest\f.cs(128493,33): error CS0115: 'System.Security.Cryptography.X509Certificates.Fakes.StubX509Certificate2.Dispose(bool)': no suitable method found to override [C:\temp\AccountsTest\obj\Debug\Fakes\s\f.csproj]
    1>GENERATEFAKES : error : project compilation failed with exit code 1
    1>C:\temp\AccountsTest\f.cs(128493,33): error CS0115: 'System.Security.Cryptography.X509Certificates.Fakes.StubX509Certificate2.Dispose(bool)': no suitable method found to override [C:\temp\AccountsTest\obj\Debug\Fakes\s\f.csproj]
    1>GENERATEFAKES : error : project compilation failed with exit code 1
    1>C:\temp\AccountsTest\f.cs(17574,44): error CS0234: The type or namespace name 'EventDataAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17575,100): error CS0234: The type or namespace name 'EventDataAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17779,44): error CS0234: The type or namespace name 'EventFieldAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17780,100): error CS0234: The type or namespace name 'EventFieldAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17984,44): error CS0234: The type or namespace name 'EventIgnoreAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17985,100): error CS0234: The type or namespace name 'EventIgnoreAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(29347,24): error CS0234: The type or namespace name 'FormattableString' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(29348,80): error CS0234: The type or namespace name 'FormattableString' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(208011,29): error CS0234: The type or namespace name 'EncodingProvider' does not exist in the namespace 'System.Text' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(208012,85): error CS0234: The type or namespace name 'EncodingProvider' does not exist in the namespace 'System.Text' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18362,67): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18376,67): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18383,91): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18392,48): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>GENERATEFAKES : error : project compilation failed with exit code 1
    1>C:\temp\AccountsTest\f.cs(17574,44): error CS0234: The type or namespace name 'EventDataAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17575,100): error CS0234: The type or namespace name 'EventDataAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17779,44): error CS0234: The type or namespace name 'EventFieldAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17780,100): error CS0234: The type or namespace name 'EventFieldAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17984,44): error CS0234: The type or namespace name 'EventIgnoreAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(17985,100): error CS0234: The type or namespace name 'EventIgnoreAttribute' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(29347,24): error CS0234: The type or namespace name 'FormattableString' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(29348,80): error CS0234: The type or namespace name 'FormattableString' does not exist in the namespace 'System' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(208011,29): error CS0234: The type or namespace name 'EncodingProvider' does not exist in the namespace 'System.Text' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(208012,85): error CS0234: The type or namespace name 'EncodingProvider' does not exist in the namespace 'System.Text' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18362,67): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18376,67): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18383,91): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>C:\temp\AccountsTest\f.cs(18392,48): error CS0234: The type or namespace name 'EventSourceSettings' does not exist in the namespace 'System.Diagnostics.Tracing' (are you missing an assembly reference?) [C:\temp\AccountsTest\obj\Debug\Fakes\m\f.csproj]
    1>GENERATEFAKES : error : project compilation failed with exit code 1
    ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

    I am using VS2013 Ultimate on Win 7.

    This seems very basic and straight forward, not sure where might be causing the problem. Any advise is appreciated. Thanks!

    Here is a video on the same topic, the "Add Fakes Assembly" step is performed at 24:00. This seems to be exactly what I am trying to do, with no success.

    http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Unit-Testing-with-Microsoft-Fakes

    • Edited by MagicMicky Wednesday, June 17, 2015 10:47 PM added video
    Wednesday, June 17, 2015 10:40 PM

Answers

  • Hi MagicMicky,

    From the error message, it seems that the issue is related to the System.dll. So I suggest you could try to check which version of the .NETFramework for creating the unit test project in the VS2013 Ultimate.

    For example, you could click System.dll and then see the Path property in the Properties window like the following screen shot.

    If you are using the .NETFramework 4.5 for creating the fakes unit test, the System.dll will use the version of .NETFramework 4.5.

    So I suggest you could try to create a new unit test project under the .NETFramework 4.0 and then check the issue.

    If the above suggestion still could not help you, maybe you will need to repair or re-install the VS2013 Ultimate check this issue again.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by MagicMicky Friday, June 19, 2015 7:06 PM
    Friday, June 19, 2015 2:46 AM
    Moderator
  • Thanks Tina! You indeed give me some inspiration on testing different framwork version / VS version combinations.

    It seems similar error also occurs for VS2013 with .net framework 4 / 4.5.1 / 4.5.2, besides 4.5 as described in the first post.

    But it works for 4.6, with warning: "warning CS0809: Obsolete member 'System.Security.Cryptography.Fakes.StubPasswordDeriveBytes.GetBytes(int)' overrides non-obsolete member 'System.Security.Cryptography.DeriveBytes.GetBytes(int)'".

    And I also tested with VS2015 Enterprise RC. It seems working fine with all framework versions. It seems stuff indeed get fixed with each new release of VS. :)

    Thanks.

    • Marked as answer by MagicMicky Friday, June 19, 2015 7:06 PM
    Friday, June 19, 2015 5:14 PM

All replies

  • Hi MagicMicky,

    From the error message, it seems that the issue is related to the System.dll. So I suggest you could try to check which version of the .NETFramework for creating the unit test project in the VS2013 Ultimate.

    For example, you could click System.dll and then see the Path property in the Properties window like the following screen shot.

    If you are using the .NETFramework 4.5 for creating the fakes unit test, the System.dll will use the version of .NETFramework 4.5.

    So I suggest you could try to create a new unit test project under the .NETFramework 4.0 and then check the issue.

    If the above suggestion still could not help you, maybe you will need to repair or re-install the VS2013 Ultimate check this issue again.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by MagicMicky Friday, June 19, 2015 7:06 PM
    Friday, June 19, 2015 2:46 AM
    Moderator
  • Thanks Tina! You indeed give me some inspiration on testing different framwork version / VS version combinations.

    It seems similar error also occurs for VS2013 with .net framework 4 / 4.5.1 / 4.5.2, besides 4.5 as described in the first post.

    But it works for 4.6, with warning: "warning CS0809: Obsolete member 'System.Security.Cryptography.Fakes.StubPasswordDeriveBytes.GetBytes(int)' overrides non-obsolete member 'System.Security.Cryptography.DeriveBytes.GetBytes(int)'".

    And I also tested with VS2015 Enterprise RC. It seems working fine with all framework versions. It seems stuff indeed get fixed with each new release of VS. :)

    Thanks.

    • Marked as answer by MagicMicky Friday, June 19, 2015 7:06 PM
    Friday, June 19, 2015 5:14 PM