Skip to content

MissingMethodException about nuget System.Numerics.Vectors #39925

@Muitsonz

Description

@Muitsonz

I had a .net std 2.0 lib which use nuget package System.Numerics.Vectors 4.5.0 by Microsoft from package manager window in Visual Studio 16.6.5. Then I created a unit test project of .net fw 4.8 using nuget package MSTest.TestAdapter 2.1.1, MSTest.TestFramework 2.1.1 (by project template), and the System.Numerics.Vectors 4.5.0 package.

When I call a method defined in the .net std lib from .net fw test project, the test can't start and report "System.MissingMethodException" to complain the method whose parameters contain System.Numerics.Vector3 is not found.
After I removed the reference to System.Numerics.Vectors nuget package, type "Vector3" was still available but in a different version, which makes compiling failed.

I reproduced the problem in a new solution, and here is the full code in the new solution:
-------------------.net std 2.0 lib------------

namespace TestVector
{
    public class Class1
    {
        public static void Method(Vector3 vector)
        {
            
        }
    }
}

-----------------.net fw 4.8 test project-----------

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            TestVector.Class1.Method(new Vector3(1, 2, 3));
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.NumericsquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions