Bug 2429 - DataContext.SubmitChanges throws InvalidCastException with Npgsql 4.0.0.0
Summary: DataContext.SubmitChanges throws InvalidCastException with Npgsql 4.0.0.0
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: 2.10.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-12-08 16:59 UTC by Cédric Belin
Modified: 2015-01-24 12:11 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Cédric Belin 2011-12-08 16:59:32 UTC
I have an ASP.NET application (4.0 profile) which uses LINQ to SQL with PostgreSQL.

Every time that I use the System.Data.Linq.DataContext.SubmitChanges method, an InvalidCastException is raised (regardless of the code).

If I use the assembly downloaded on Npgsql site (version 2.0.11.92 for .NET 4.0) instead of the one provided by Mono (version 4.0.0.0), everything works like a charm.

At first glance, there is a bug in the Npgsql assembly supplied in the Mono stack.

Here is a typical stack trace :

Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Data.Linq.DataContext.SubmitChanges (ConflictMode failureMode) [0x00000] in <filename unknown>:0 
  at System.Data.Linq.DataContext.SubmitChanges () [0x00000] in <filename unknown>:0 
  at JypoEditions.Data.Shipping.SetDefault (JypoEditions.Data.Shipping entity) [0x0004f] in /Users/Cedric/Repository/Web/JypoEditions/Sources/Shipping.cs:100 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod (System.Reflection.MethodInfo method, IOrderedDictionary paramValues) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Web.UI.Page.ProcessException (System.Exception e) [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication+<Pipeline>c__Iterator6.MoveNext () [0x00000] in <filename unknown>:0 
  at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0

Note You need to log in before you can comment on or make changes to this bug.