locked
Can not generate fakes methods that have parameters of type X509Certificate2 RRS feed

  • Question

  • I have a little project, that uses Fakes for unit tests. Since i instaled Visual Studio 2015 RTM, it stops generate fakes from methods using X509Certificate2 on signature.

    any one know anything about this?

    Wednesday, July 22, 2015 6:12 PM

All replies

  • Hi AndrePassos,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    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.

    Friday, July 24, 2015 5:51 AM
  • Hi Partner,

    Do you get any error message? And can you provide here some code you're working with?

    Thanks.


    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.

    Tuesday, July 28, 2015 12:02 PM
  • No error message.

    My class

        public class Class1
        {
            public static void Test(X509Certificate2 certificate)
            {
                throw new NotImplementedException();
            }
    
            public static void Test2(string buz)
            {
                throw new NotImplementedException();
            }
        }

    And test class

        [TestClass]
        public class UnitTest1
        {
            [TestMethod]
            public void TestMethod1()
            {
                // Method TestX509Certificate2 does not exists
                ShimClass1.TestX509Certificate2
            }
        }

    Tuesday, July 28, 2015 12:59 PM
  • I am getting a similar error with Visual Studio 2013 Update 5.  It says that X509Certificate2 interface cannot be created.  The error is:

    unstubbable: method is abstract and could not be stubbed. Reason: type System.Security.Cryptography.X509Certificates.X509Certificate2 is not available in the target framework version

    To fix this, I had to upgrade to .Net 4.6.


    • Edited by BulletBait Wednesday, July 29, 2015 11:53 PM Update
    Tuesday, July 28, 2015 9:50 PM
  • I have this error to. I already made a stackoverflow post and a bug rapport on the Framework because the message says the class doesn't exist. 

    The problem is VS2013 Update 5 RTM and not Visual Studio 2015. I tested this with several machines.

    I created a test project so you could reproduce the error. See the stack overflow for the code.

    See the stack overflow post:
    http://stackoverflow.com/questions/31668629/system-security-cryptography-x509certificates-x509certificate2-is-not-available

    And bug rapport on Github:
    https://github.com/dotnet/coreclr/issues/1303

    Wednesday, July 29, 2015 6:36 AM
  • Any update on this?
    Monday, August 3, 2015 7:58 AM