“Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources” not found












0















I'm trying to create an integration test in .NET Core 2.1 with the latest Visual Studio 2017 build. There is nothing special about my setup whatsoever.



If I put the "async" keyword on a test, as is needed to test async methods, VS will terminate before attempting to run any tests with a FileNotFound exception. The missing file is "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources".



So the question (other than 'how does Microsoft keep managing to release such broken frameworks') is: Why?



using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ServiceClients.IntegrationTests
{
[TestClass]
public class SicklyUnitTest
{
[TestInitialize]
public void Initialize()
{
}

// This is fine
[TestMethod]
public void TrueIsTrue()
{
Assert.IsTrue(true);
}

// This causes FileNotFound - "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources"
[TestMethod]
public async void DeOmnibusDubitandum()
{
Assert.IsTrue(true);
}
}
}









share|improve this question


















  • 2





    Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

    – Nkosi
    Jan 2 at 23:53













  • async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

    – Nkosi
    Jan 2 at 23:58






  • 2





    and what happens when you try it with a Task instead of void?

    – Nkosi
    Jan 3 at 0:06






  • 2





    Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

    – Simply Ged
    Jan 3 at 5:17






  • 1





    Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

    – Simply Ged
    Jan 3 at 5:20
















0















I'm trying to create an integration test in .NET Core 2.1 with the latest Visual Studio 2017 build. There is nothing special about my setup whatsoever.



If I put the "async" keyword on a test, as is needed to test async methods, VS will terminate before attempting to run any tests with a FileNotFound exception. The missing file is "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources".



So the question (other than 'how does Microsoft keep managing to release such broken frameworks') is: Why?



using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ServiceClients.IntegrationTests
{
[TestClass]
public class SicklyUnitTest
{
[TestInitialize]
public void Initialize()
{
}

// This is fine
[TestMethod]
public void TrueIsTrue()
{
Assert.IsTrue(true);
}

// This causes FileNotFound - "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources"
[TestMethod]
public async void DeOmnibusDubitandum()
{
Assert.IsTrue(true);
}
}
}









share|improve this question


















  • 2





    Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

    – Nkosi
    Jan 2 at 23:53













  • async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

    – Nkosi
    Jan 2 at 23:58






  • 2





    and what happens when you try it with a Task instead of void?

    – Nkosi
    Jan 3 at 0:06






  • 2





    Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

    – Simply Ged
    Jan 3 at 5:17






  • 1





    Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

    – Simply Ged
    Jan 3 at 5:20














0












0








0


1






I'm trying to create an integration test in .NET Core 2.1 with the latest Visual Studio 2017 build. There is nothing special about my setup whatsoever.



If I put the "async" keyword on a test, as is needed to test async methods, VS will terminate before attempting to run any tests with a FileNotFound exception. The missing file is "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources".



So the question (other than 'how does Microsoft keep managing to release such broken frameworks') is: Why?



using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ServiceClients.IntegrationTests
{
[TestClass]
public class SicklyUnitTest
{
[TestInitialize]
public void Initialize()
{
}

// This is fine
[TestMethod]
public void TrueIsTrue()
{
Assert.IsTrue(true);
}

// This causes FileNotFound - "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources"
[TestMethod]
public async void DeOmnibusDubitandum()
{
Assert.IsTrue(true);
}
}
}









share|improve this question














I'm trying to create an integration test in .NET Core 2.1 with the latest Visual Studio 2017 build. There is nothing special about my setup whatsoever.



If I put the "async" keyword on a test, as is needed to test async methods, VS will terminate before attempting to run any tests with a FileNotFound exception. The missing file is "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources".



So the question (other than 'how does Microsoft keep managing to release such broken frameworks') is: Why?



using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ServiceClients.IntegrationTests
{
[TestClass]
public class SicklyUnitTest
{
[TestInitialize]
public void Initialize()
{
}

// This is fine
[TestMethod]
public void TrueIsTrue()
{
Assert.IsTrue(true);
}

// This causes FileNotFound - "Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources"
[TestMethod]
public async void DeOmnibusDubitandum()
{
Assert.IsTrue(true);
}
}
}






.net-core async-await visual-studio-2017 mstest






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 23:53









MaxxMaxx

816




816








  • 2





    Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

    – Nkosi
    Jan 2 at 23:53













  • async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

    – Nkosi
    Jan 2 at 23:58






  • 2





    and what happens when you try it with a Task instead of void?

    – Nkosi
    Jan 3 at 0:06






  • 2





    Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

    – Simply Ged
    Jan 3 at 5:17






  • 1





    Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

    – Simply Ged
    Jan 3 at 5:20














  • 2





    Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

    – Nkosi
    Jan 2 at 23:53













  • async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

    – Nkosi
    Jan 2 at 23:58






  • 2





    and what happens when you try it with a Task instead of void?

    – Nkosi
    Jan 3 at 0:06






  • 2





    Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

    – Simply Ged
    Jan 3 at 5:17






  • 1





    Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

    – Simply Ged
    Jan 3 at 5:20








2




2





Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

– Nkosi
Jan 2 at 23:53







Framework is not broken. You are writing bad code. Avoid async void. Use public async Task DeOmnibusDubitandum() You should also check to make sure you have the correct versions/ packages referenced.

– Nkosi
Jan 2 at 23:53















async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

– Nkosi
Jan 2 at 23:58





async void are fire and forget, so it is being invoked before anything else in the test has had time to be invoked, thus the error.

– Nkosi
Jan 2 at 23:58




2




2





and what happens when you try it with a Task instead of void?

– Nkosi
Jan 3 at 0:06





and what happens when you try it with a Task instead of void?

– Nkosi
Jan 3 at 0:06




2




2





Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

– Simply Ged
Jan 3 at 5:17





Where do you see the exception? When I run your test I get a warning Method DeOmnibusDubitandum defined in class ServiceClients.IntegrationTests.SicklyUnitTest does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, if you are using async-await in test method then return-type must be Task. Example: public async Task Test.Class1.Test2()

– Simply Ged
Jan 3 at 5:17




1




1





Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

– Simply Ged
Jan 3 at 5:20





Also can you add which NuGet packages and versions you are referencing please? e.g. Microsoft.NET.Test.SDK, MSTest.TestAdapater and MSTest.TestFramework

– Simply Ged
Jan 3 at 5:20












1 Answer
1






active

oldest

votes


















0














Method that is marked with TestInitialize attribute should be a static method. Make it static and the below exception will be fixed.



{System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources'
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)}






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014694%2fmicrosoft-visualstudio-testplatform-mstest-testadapter-resources-not-found%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Method that is marked with TestInitialize attribute should be a static method. Make it static and the below exception will be fixed.



    {System.IO.FileNotFoundException: Could not load the specified file.
    File name: 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources'
    at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)}






    share|improve this answer




























      0














      Method that is marked with TestInitialize attribute should be a static method. Make it static and the below exception will be fixed.



      {System.IO.FileNotFoundException: Could not load the specified file.
      File name: 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources'
      at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)}






      share|improve this answer


























        0












        0








        0







        Method that is marked with TestInitialize attribute should be a static method. Make it static and the below exception will be fixed.



        {System.IO.FileNotFoundException: Could not load the specified file.
        File name: 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources'
        at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)}






        share|improve this answer













        Method that is marked with TestInitialize attribute should be a static method. Make it static and the below exception will be fixed.



        {System.IO.FileNotFoundException: Could not load the specified file.
        File name: 'Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources'
        at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)}







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 26 at 7:08









        DanKodiDanKodi

        2,5371919




        2,5371919
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014694%2fmicrosoft-visualstudio-testplatform-mstest-testadapter-resources-not-found%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas