Submit Error is Not Handled

4 posts, 0 answers
  1. Jen
    Jen avatar
    4 posts
    Member since:
    Mar 2011

    Posted 14 Apr 2011 Link to this post

    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?
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 15 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Jen
    Jen avatar
    4 posts
    Member since:
    Mar 2011

    Posted 15 Apr 2011 Link to this post

    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

     

     

  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Apr 2011 Link to this post

    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
Back to Top