0
votes

I have a Simple test

public void TestCertificateThumbprint()
        {
            var xc = GetCredentials(this.clientCertThumb, this.serverCertThumb, this.commonName);
            var fc = new FabricClient(xc, this.connection);

        try
        {
            var ret = fc.ClusterManager.GetClusterManifestAsync().Result;
            Assert.IsNotNull(ret);
        }
        catch (Exception e)
        {
            Console.WriteLine("Connect failed: {0}", e.Message);
            Assert.IsNull(e);
        }

        Assert.IsTrue(true);
    }

I encountered no issues running this test against azure cluster in cloud from my local but through VSTS, running into Issues

Test method TestCertificateThumbprint threw exception:

System.BadImageFormatException: Could not load file or assembly 'System.Fabric, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I have checked the versions, They are valid and they are fetched in the nuget restore build task of VSTS ( based on log file console output)

Environment: VS 2017, Azure Service Fabric, Unit tests, Package : Microsoft.ServiceFabric.6.0.232

1

1 Answers

1
votes

Make sure that your project is targeting x64 as all Service Fabric assemblies are compiled to x64 and Azure Service Fabric only supports x64 platform.

Refer the below SO link for more information.

Service Fabric System.BadImageFormatException