Skip to content

Error CS1503 : Argument 2: cannot convert from 'Xml.Schema.Linq.SimpleTypeValidator' to 'System.ReadOnlySpan<char>' #87

@Foxite

Description

@Foxite

I have downloaded an RSS schema from here: https://github.com/musiKk/rss-schema/blob/master/src/main/xsd/rss-2.0.xsd

Running LinqToXsd gen -e rss-2.0.xsd produces this file: rss-2.0.xsd.cs

When I put this file into a .NET 10 project that references Xml.Schema.Linq.NetStandard2 1.0.1, there is a single error in the file:

public virtual version? version {
    get {
        XAttribute x = this.Attribute(versionXName);
        if ((x == null)) {
            return null;
        }
        return ((version)(Enum.Parse(typeof(version), XTypedServices.ParseValue(x, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String).Datatype, versionValidator.TypeDefinition))));

Rss.xsd.cs(83,59): Error CS1503 : Argument 2: cannot convert from 'Xml.Schema.Linq.SimpleTypeValidator' to 'System.ReadOnlySpan<char>'

Enum.Parse only takes string and ReadOnlySpan<char> as its second argument, but the XTypedServices.ParseValue call returns the type of its third argument, that being SimpleTypeValidator.

I don't really know what to change about the XTypedServices.ParseValue call to make this compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions