Skip to content

TypeLoadException on mono 4.2.1 #424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sklose opened this issue Dec 18, 2015 · 5 comments
Closed

TypeLoadException on mono 4.2.1 #424

sklose opened this issue Dec 18, 2015 · 5 comments

Comments

@sklose
Copy link

sklose commented Dec 18, 2015

I am getting this exception when I try to use Dapper on mono

System.TypeInitializationException: The type initializer for 'Dapper.SqlMapper' threw an exception. 
---> System.TypeLoadException: Failed for unknown reasons.

Looking at the type initializer code of SqlMapper and the mono documentation, it seems that

AddTypeHandlerImpl(typeof(IEnumerable<Microsoft.SqlServer.Server.SqlDataRecord>), new SqlDataRecordHandler(), false);

is the culprit - Microsoft.SqlServer.Server.SqlDataRecord is listed nowhere in the mono docs, I guess it isn't implemented.

@mgravell
Copy link
Member

K, that's fun. I will see if we can wrap that in some hackery to dodge
around that. Should have something in the next few days.
On 18 Dec 2015 23:20, "Sebastian Klose" [email protected] wrote:

I am getting this exception when I try to use Dapper on mono

System.TypeInitializationException: The type initializer for 'Dapper.SqlMapper' threw an exception.
---> System.TypeLoadException: Failed for unknown reasons.

Looking at the type initializer code of SqlMapper and the mono
documentation, it seems that

AddTypeHandlerImpl(typeof(IEnumerable<Microsoft.SqlServer.Server.SqlDataRecord>), new SqlDataRecordHandler(), false);

is the culprit - Microsoft.SqlServer.Server.SqlDataRecord is listed
nowhere in the mono docs, I guess it isn't implemented.


Reply to this email directly or view it on GitHub
#424.

@mgravell
Copy link
Member

Please can I ask you to verify via 1.50.0-beta6 (available on nuget)?

@sklose
Copy link
Author

sklose commented Dec 19, 2015

It's working for me, thanks for the quick fix!

@mgravell
Copy link
Member

@sklose thanks for a clear bug report that let me understand exactly what the problem was and what needed changing ;p (sadly, they're not always so clear)

@NilufarMakhmudova
Copy link

@mgravell, we are experiencing a similar problem with our Xamarin Android solution with SQLite database, where Dapper 1.50.5 NuGet package is installed.
System.TypeInitializationException: The type initializer for 'Dapper.SqlMapper' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Dapper.SqlMapper.AddTypeHandlerImpl (System.Type type, Dapper.SqlMapper+ITypeHandler handler, System.Boolean clone)
at Dapper.SqlMapper.ResetTypeHandlers (System.Boolean clone)
at Dapper.SqlMapper..cctor ()

Are there any clues on how to fix it?

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

No branches or pull requests

3 participants