Skip to content

Lack of tests with MarshalCharAsManagedChar = false is causing issues now and will in the future #1424

Open
@josetr

Description

@josetr

CSharp test projects wont build

// A value of type 'char' cannot be used as a default parameter because there are no standard 
public void DefaultChar(sbyte c = 'a')

public sbyte** Names {
    get {
      // Cannot take the address of, get the size of, or declare a conversions to type 'sbyte'
        return (string*) ((global::CSharp.TestPointers.__Internal*) __Instance)->Names;
    }
}
// error CS1503: Argument 1: cannot convert from 'char' to 'sbyte'
Assert.That(*CSharp.CSharp.TakeConstCharRef(z), Is.EqualTo(z));

// error CS1503: Argument 1: cannot convert from 'char*' to 'sbyte*'
Assert.That(*CSharp.CSharp.TakeCharPointer(&c), Is.EqualTo(c));

These other bugs would have been found much sooner with MarshalCharAsManagedChar set to false

#1417
#1420
#1409

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions