Skip to content

Fixes "Enum Invalid cast from 'System.Int64' (works without AOT)" #92#171

Open
andreasblueher wants to merge 6 commits intoDapperLib:mainfrom
andreasblueher:issue92
Open

Fixes "Enum Invalid cast from 'System.Int64' (works without AOT)" #92#171
andreasblueher wants to merge 6 commits intoDapperLib:mainfrom
andreasblueher:issue92

Conversation

@andreasblueher
Copy link

Hey @mgravell,

here's the pull request you asked for. I based it on the issue92 branch you had already created and not on main, which caused some sqllite things to end up in this branch. I can create another branch based on your main if needed.

#92

I tried to change as little as possible. Kind regards and thank you for the tool

mgravell and others added 6 commits December 18, 2023 15:02
# Conflicts:
#	Directory.Packages.props
#	test/Dapper.AOT.Test/Dapper.AOT.Test.csproj
Convert.ChangeType does not support enum target types, causing
InvalidCastException when the reader returns Int64/Byte/String
for enum-typed properties. Use Enum.ToObject for numeric values
and Enum.Parse for strings instead.

Also adjust SqliteTests to exclude NETFRAMEWORK since main dropped
the System.Data.SQLite package reference.
Cover Int64, Int32, Byte to enum, string to enum (case-insensitive),
nullable enum, and null-to-nullable-enum paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants