Skip to content

TypeHanderCache issue #165

@PatrickNies

Description

@PatrickNies

Hi,

i've following issue with dapper after Publishing my software as AOT:

'Dapper.SqlMapper+TypeHandlerCache' 1[System.Guid]' is missing native code or metadata. This can happen for code that is not compatible with trimming or AOT. Inspect and fix trimming and AOT related warnings that were generated when the app was published. For more information see
https://aka.ms/nativeaot-compatibility

Already added an Handler for GUID:

public sealed class GuidAsStringHandler : SqlMapper.TypeHandler<Guid>
{
    public override void SetValue(IDbDataParameter parameter, Guid value)
        => parameter.Value = value.ToString();

    public override Guid Parse(object value) => value switch
    {
        string s => Guid.Parse(s),
        byte[] b => new Guid(b),
        _ => Guid.Parse(Convert.ToString(value)!)
    };
}

I didn't see any warning about this while building

Can you give me an advice on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions