Skip to main content
Home Forums Silverlight Programming WCF RIA Services RIA Services (July): Need Inner Exception
6 replies. Latest Post by jperl on November 6, 2009.
(0)
jperl
Member
25 points
39 Posts
07-19-2009 12:34 AM |
Is there any way to get better debugging information with RIA Services?
I am trying to insert a new entity to the database, but I think I am running into some sort of constraint issue.
When I call the submit operation: Context.SubmitChanges(SaveOperationCallback, null);, it goes straight to my callback without hitting the insert method on my domain.
The exception in the callback of the submit operation is this:
[System.Windows.Ria.Data.EntityOperationException] = {System.Windows.Ria.Data.EntityOperationException: Exception has been thrown by the target of an invocation. at System.Windows.Ria.Data.HttpDomainClient.GetRequestResult(HttpDomainClientAsyncResult httpAsyncResult) at System.Windows.Ria.Data.HttpDom...
But the inner exception is null.
In my output I have:
A first chance exception of type 'System.Data.ConstraintException' occurred in System.Data.Entity.dllA first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dllA first chance exception of type 'System.Reflection.TargetInvocationException' occurred in System.Web.Extensions.dllA first chance exception of type 'System.Windows.Ria.Data.EntityOperationException' occurred in System.Windows.Ria
I have searched this for a bit, and I put <customErrors mode="Off" /> under the system.web section of my web.config file, but the inner exception is still null.
I am using ASP .NET MVC 1.0 and SQL Server 2008 with Entity Framework V1. I am able to insert and update other entities, so there is not a connection issue.
Thank you for any help in advance.
07-19-2009 5:07 AM |
Also, when I try to insert a empty object to the entity set it does not hit my breakpoint in the insert method of my domain context. It does the same thing as described above and goes straight to my submit operation callback.
07-25-2009 7:17 PM |
Anyone know of a way to get constraint exception details?
Greg Pha...
4 points
2 Posts
07-26-2009 2:52 PM |
Put a breakpoint in the generated code and you will see the exception.
07-26-2009 3:10 PM |
Greg Phaling:Put a breakpoint in the generated code and you will see the exception.
Thanks, I figured it out. This was a combination of multiple problems.
For anyone else getting similar errors here is what I did.
I setup VS to break when there was an exception: Under Debugging, Exceptions select Common Language Runtime Exceptions and Managed Debugging Assistants.
The main problem was I had my ADO .Net Entity with non-nullable references to other entities and I tried to add an entity to the set without setting those references.
I was going to setup the references in the domain service insert method but before it could hit that method it would throw a sql exception. It was going straight back to my submit operation callback with an error and no details before I could set the references in the insert method.
So I changed those references to nullable and now it works!
71732007
8 points
4 Posts
11-06-2009 2:10 PM |
Hello Jperl,
I having like same problem, could you tell me what references you put to nullable ????
thans a lot,
fausto
11-06-2009 4:59 PM |
On your entity make sure you setup any properties and references whose corresponding rows in your database don't allow nulls before submitting changes.
For example you have an entity SchoolClass, with a property Name and a Teacher reference. The corresponding table in your database is SchoolClass: UniqueId id (No Nulls), varchar name (No Nulls), and teacher_id (No Nulls).
You would need to setup all of the properties: SchoolClass math = new SchoolClass(); math.Id = Guid.NewGuid(), math.Name="Math", math.Teacher=new Teacher()
Inserting a row will null references might not be your problem. If you disable Just My Code and setup VS to break for managed exceptions (instructions above) it will tell you what your problem is.