Skip to content

Predefined type 'System.Int32' is not defined or imported starting in v4.14.4 #462

@Methuselah96

Description

@Methuselah96

My CS-Script test cases started failing with 4.14.4 when running them on Ubuntu. Here is a repo that demonstrates that the following code regressed in 4.14.4:

using CSScriptLib;

namespace TestCase;

public class Point
{
    public int X { get; set; }
    public int Y { get; set; }
}

[TestFixture]
public class DynamicEvaluationTests
{
    [Test]
    public void TestCSScript()
    {
        dynamic script = CSScript.Evaluator.LoadCode(
            @"using TestCase;
             public class Script
             {
                 public Point CreatePoint(int x, int y)
                 {
                     return new Point { X = x, Y = y };
                 }
             }"
        );
        var result = script.CreatePoint(1, 2);
        Assert.That(result.X, Is.EqualTo(1));
        Assert.That(result.Y, Is.EqualTo(2));
    }
}

Note that strangely this works on Windows, but not Ubuntu.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions