You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
@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)
@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 ()
Activity
mgravell commentedon Dec 18, 2015
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:
mgravell commentedon Dec 19, 2015
Please can I ask you to verify via 1.50.0-beta6 (available on nuget)?
sklose commentedon Dec 19, 2015
It's working for me, thanks for the quick fix!
mgravell commentedon Dec 19, 2015
@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 commentedon Aug 3, 2018
@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?
Be more defensive when adding SqlDataRecord handler; fix DapperLib#424