DapperLib / DapperLib/DapperAOT
TypeHanderCache issue
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 472
- Forks
- 43
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 18
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported C# application after publishing it as AOT, then inspect the generated trimming/AOT warnings and the TypeHandlerCache error. Done means the Guid handler scenario no longer fails under AOT and the relevant compatibility warnings are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100