dotnet/roslyn

MethodNotFoundException CSharpScripting.Compile(...)

开放

#40,983 创建于 2020年1月15日

 (0 条评论) (0 个反应) (1 位负责人)C# (4,257 个派生)batch import
Area-InteractiveBugInteractive-ScriptingLogichelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Version Used: 3.4.0

Steps to Reproduce:

    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            try
            {
                // Creating the script
                var compiled = CSharpScript.Create<string>(@"return ""ciao"";");
                compiled.Compile();
                var runner = compiled.CreateDelegate();

                var result = runner().GetAwaiter().GetResult();

                Assert.AreEqual("ciao", result);
            }
            catch (Exception ex)
            {

            }
        }
    }

Expected Behavior: Test pass

Actual Behavior: The test does not run, it compiles but throw at runtime System.MissingMethodException: Method not found: 'System.Collections.Immutable.ImmutableArray1<Microsoft.CodeAnalysis.Diagnostic> Microsoft.CodeAnalysis.Scripting.Script.Compile(System.Threading.CancellationToken)'.`

贡献者指南