This is a migrated thread and some comments may be shown as answers.

Submit Error is Not Handled

3 Answers 89 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Jen
Top achievements
Rank 1
Jen asked on 14 Apr 2011, 09:17 PM

I have a button that updates product information and I started seeing this error:
Microsoft JScript runtime error: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.Exception: Submit error is not handled!
   at Telerik.Windows.Data.QueryableDomainServiceCollectionView`1.OnDomainContextSubmittCompleted(SubmitOperation submitOperation)
   at System.ServiceModel.DomainServices.Client.SubmitOperation.InvokeCompleteAction()
   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
   at System.ServiceModel.DomainServices.Client.SubmitOperation.Complete(OperationErrorStatus errorStatus)
   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClassb.<SubmitChanges>b__3(Object )    

I'm a Silverlight novice, so I'm not sure what it's telling me.
 Here is the code for the button click and Domain Data Source:

private void ddsSummaryLoadedData( object sender, 
                Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs e )
    {
     try
       {
          //Data is now loaded so lets fill our controls.
              if ( e.HasError == false )
               {
                   //Get our record object.
                   Summary sum = ( Summary )e.Entities.First();
                   CurrentSummary = sum;//Save for later.
                   WR_IDText.Text = sum.WorkRequest;
                   WR_SuffixText.Text = sum.WorkRequestSuffix;
                   ProductVersionText.Text = sum.ProductVersion;
                   if ( sum.ApprovalDateTime.HasValue == true )
                   {
        //ApprovalDatePicker.CurrentDateTimeText = sum.ApprovalDateTime.Value.ToShortDateString();
                       ApprovalDatePicker.SelectedDate = ( System.DateTime )sum.ApprovalDateTime;
                   }
                   if ( sum.ReportDateTime.HasValue == true )
                   {
          //ReportDatePicker.CurrentDateTimeText = sum.ReportDateTime.Value.ToShortDateString();
                       ReportDatePicker.SelectedDate = ( System.DateTime )sum.ReportDateTime;
                   }
                   //Clear.
                   sum = null;
               }
               else
               {
                   //Display error.
                   ErrorWindow.CreateNew( e.Error, 
                      StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
               }
           }
           catch ( Exception ex )
           {
               //Display error.
               ErrorWindow.CreateNew( ex, StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
           }
       }

private void ddsSummaryIterationsLoadedData( object sender, 
            Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs e )
       {
           try
           {
               //Data is now loaded.
               if ( e.HasError == false )
               {
                   IterationTitleLabel.Text = "Iterations - " + e.TotalEntityCount.ToString() 
                            +
" rows";
               }
               else
               {
                   //Display error.
                   ErrorWindow.CreateNew( e.Error, 
                            StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
               }
           }
           catch ( Exception ex )
           {
               //Display error.
               ErrorWindow.CreateNew( ex,     
                        StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
           }
       }

private void ddsSummaryIterations_SubmittedChanges( object sender, 
                DomainServiceSubmittedChangesEventArgs e )
       {
           try
           {
               if ( e.HasError == false )//Make sure there wasn't any errors.
               {
                   if ( e.Cancelled == false )//Make sure it wasn't cancelled and it's complete.
                   {
                       //Refresh controls.
                       ddsSummaryIterations.Load();
                       DeleteIterationButton.IsEnabled = false;
                   }
               }
               else
               {
                   //Display error.
                   ErrorWindow.CreateNew( e.Error, 
                            StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
               }
           }
           catch ( Exception ex )
           {
               //Display error.
               ErrorWindow.CreateNew( ex, 
                        StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
           }
       }

private void SaveSummaryButtonClick( object sender, RoutedEventArgs e )
       {
           try
           {
               //Make sure we aren't already submitting and or loading data.
               if ( ddsSummary.IsSubmittingChanges == false & ddsSummary.IsLoadingData == false &
IsUnique ==
true )
               {
                   //Make changes to entity.
                   CurrentSummary.WorkRequest = WR_IDText.Text;
                   CurrentSummary.WorkRequestSuffix = WR_SuffixText.Text;
                   CurrentSummary.ProductVersion = ProductVersionText.Text;
                   CurrentSummary.HistoricalInfo_LUser = 0;
                   CurrentSummary.HistoricalInfo_LDateTime = DateTime.Now;
                   CurrentSummary.HistoricalInfo_LAction = "U";
                   if ( ApprovalDatePicker.SelectedDate != null )
                       CurrentSummary.ApprovalDateTime = ApprovalDatePicker.SelectedDate;
                   else
                       CurrentSummary.ApprovalDateTime = null;
                   if ( ReportDatePicker.SelectedDate != null )
                       CurrentSummary.ReportDateTime = ReportDatePicker.SelectedDate;
                   else
                       CurrentSummary.ReportDateTime = null;
                   //Send for an update.
                   ddsSummary.SubmitChanges();
               }
           }
           catch ( Exception ex )
           {
               //Display error.
               ErrorWindow.CreateNew( ex, StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
           }
       }

private void OnSubmitCompleted( SubmitOperation e )
       {
           try
           {
               if ( e.HasError == false )//Make sure there wasn't any errors.
               {
                   if ( e.IsCanceled == false & e.IsComplete == true )//Make sure it wasn't cancelled and it's complete.
                   {
                       //Refresh controls.
                       ddsSummaryIterations.QueryParameters[ 0 ].Value = CurrentSummary.Id;
                       ddsSummaryIterations.Load();
                   }
               }
               else
               {
                   //Display error.
                   ErrorWindow.CreateNew( e.Error, 
                            StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
               }
           }
           catch ( Exception ex )
           {
               //Display error.
               ErrorWindow.CreateNew( ex, StackTracePolicy.OnlyWhenDebuggingOrRunningLocally );
           }
       }

And here is the code from the Update section of the domain service file:
#region Update Data Methods
  
        public void UpdateSummary( Summary currentSummary )
        {
            this.ObjectContext.Summaries.AttachAsModified( currentSummary, 
                        
this.ChangeSet.GetOriginal( currentSummary ) );
        }
  
        #endregion

Any advice?

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 15 Apr 2011, 07:15 AM
Hi,

 Can you check the exception/inner exception using the debugger?

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jen
Top achievements
Rank 1
answered on 15 Apr 2011, 02:55 PM
I tried adding Console.WriteLine(ex.InnerException); under catch(Exception ex) but this did not give anything different than the above code. I still get a popup of Microsoft Script Editor with the above error. I don't see any other details or where to click for them. I don't know if this helps any, but since the exception occurs when the 'save' button is clicked, I place a break point there and the debug output window contains this:

A first chance exception of type 'System.ArgumentException' occurred in Telerik.Windows.Controls.DomainServices

A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.DomainServices.Hosting.dll

A first chance exception of type 'System.NullReferenceException' occurred in Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll

A first chance exception of type 'System.NullReferenceException' occurred in CIMM.Common

A first chance exception of type 'System.NullReferenceException' occurred in CIMM.Common

A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll

A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in System.ServiceModel.DomainServices.Hosting.dll

A first chance exception of type 'System.NullReferenceException' occurred in Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll

 

 

0
Rossen Hristov
Telerik team
answered on 18 Apr 2011, 10:11 AM
Hello Jen,

From the stack trace you have provided it seems that there is some kind of WCF RIA Services CommunicationException.

You might get more info regarding this exception on the WCF RIA Services forums.

Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DomainDataSource
Asked by
Jen
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jen
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or