We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Spreadsheet save appears to corrupt the file in a way that prevent reloading in Spreadsheet control without application hang


Create a form called test with a spreadsheet called ManifestSpreadsheet and two buttons called button1 and button2


Public Class Test
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        PopulateManifestSpreadsheet()
    End Sub

    Private Sub PopulateManifestSpreadsheet()
        Try
            Dim s = "C:\Users\skytr\Source\Repos\ExcelDisplay\ExcelDisplay\bin\Debug\MasterFiles\ManifestLoadOrder2018-12-29.xlsx"
            ManifestSpreadsheet.Opens)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ManifestSpreadsheet.Save()
    End Sub
End Class


I've provided the spreadsheet.

 Repro Steps

  1. Start app
  2. Click button1 spreadsheet is open
  3. Make some changes
  4. Click button2
Step 5
Click button1 - doesnt load
or
Restart app click button1 - doesnt load

Resolution
  1. Open spreadsheet in excel (no changes)
  2. Save spreadsheet
  3. Restart app click button1 - loads



So I would say there is something going on in the save method which is causing subsequent loads to fail.   But that using excel to open/save file does something different and allows load to occur.


Attachment: ManifestLoadOrder20181229_61615777.zip

12 Replies

SP Spotty December 31, 2018 04:51 PM UTC

I've included the repro project.  Along with a repro video and a number of the files that were created - both after the save and after resaving using excel.   You will notice the file sizes are significant which might provide a clue to what has occurred.

Spread1AfterSave.xlsx  was after the Spreadsheet Save
Spread1AfterExcel.xlsx  was after the Spreadsheet Save file was loaded into excel and re-saved


Attachment: WindowsApp1_52e8ba55.zip


AA Arulraj A Syncfusion Team January 3, 2019 03:30 PM UTC

 
Thanks for using Syncfusion product. 
 
We are able to see the reported problem. We have logged a bug report for the same and the fix will be available in the 2018 Volume 4 SP1 release which is planned in the first week of February 2019. 
 
Regards,  
Arulraj A  



SP Spotty February 12, 2019 08:37 PM UTC

Still broken but in a different way now.

The following zip includes 2 files one of which was working and saved with spreadsheet control (Copy) and the other was taken into excel after it failed to load and saved and worked again.  The file sizes vary by quite a bit.

When loading the corrupted file - after save the following exception is generated when trying to load the spreadsheet.


System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred.
  Source=mscorlib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.CustomXmlPartExt.ReadCalcChainXMLElements(Spreadsheet sfSpreadsheet, Stream mStream)
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.FormulaHelper.OpenWorkbookInZipArchive(Stream fileStream, Spreadsheet sfSpreadsheet)
   at Syncfusion.Windows.Forms.Spreadsheet.Spreadsheet.<>c__DisplayClass2f.<StartFormulaThread>b__2e()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.

The current version of the spreadsheet control is 16.4460.0.52

I'm more than happy to work with the team to resolve and test the issues, but clearly there is still a problem.  






Attachment: ManifestLoadOrder20190212__Copy_cde5f67a.zip


AA Arulraj A Syncfusion Team February 13, 2019 12:25 PM UTC

Hi Spotty, 

Thanks for your update. 

We can reproduce your reported scenario. We suspect that this is a bug so we have forwarded this query to our development team for further analysis. We will check and update the details on 15th February 2019. 

Thanks for your patience until then. 

Regards,  
Arulraj A  



AA Arulraj A Syncfusion Team February 15, 2019 11:34 AM UTC

Hi Spotty,  

Thanks for your patience.  

We are still working on this, we need some more time to validate this. We will let you know the details on 19th February 2019.  

Thanks for your patience until then.  

Regards,   
Arulraj A   



AA Arulraj A Syncfusion Team February 19, 2019 02:03 PM UTC

Hi Spotty,   
 
Thanks for your patience.   
 
We have confirmed the issue “Exception raised while opening the Excel file with a namespace not defined” and logged a bug report for the same. We will update you the patch on 27 February 2019. 
 
Regards,  
Arulraj A 



AR Arulpriya Ramalingam Syncfusion Team January 8, 2020 06:05 AM UTC

Hi Spotty, 
 
Thank you for your patience. 
 
The reported issue has been fixed at our end and the fix is included from 2018 Vol4 SP1 (16.4.0.52) release. So, we request you to upgrade to our latest version to overcome this scenario and please make use of below release notes with download links. 
 
 
Please let us know the product version, if you need patch for the reported use case. 
 
Regards, 
Arulpriya 



SP Spotty February 7, 2020 08:06 PM UTC

This is still broken or at least it causes problems - I appear to be finding many problems with this control - is anyone testing this ?


1. Open the attached excel spreadsheet file (M1 file) in Spreadsheet Control on a form
2. Make a simple edit (ie change the contents of any cell)
3. Save the spreadsheet
4. Attempt to open the excel file again - 

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Syncfusion.Spreadsheet.Windows
  StackTrace:
   at Syncfusion.Windows.Forms.CellGrid.GridConditionalFormat.CalculateReference(SfCellGrid grid, GridConditionalFormatType conditionalformattype, Object calcvalue, GridCondition condition)
   at Syncfusion.Windows.Forms.Spreadsheet.Helpers.ConditionalFormatHelper.ApplyHighlightedCellsRules(SpreadsheetColumn column, String value, IConditionalFormat excelConditionalFormat, GridRangeInfo address, Boolean& isBackgroundApplied, Boolean& isStyleApplied)
   at Syncfusion.Windows.Forms.Spreadsheet.SpreadsheetColumn.ApplyConditionalFormats(SpreadsheetPaint drawingContext, Rectangle cellRect)
   at Syncfusion.Windows.Forms.Spreadsheet.SpreadsheetColumn.OnRender(SpreadsheetPaint paint, Rectangle cellRect, Rectangle clipRect, Boolean drawGridLines, Boolean adjustBackgroundRect)
   at Syncfusion.Windows.Forms.CellGrid.VirtualizingRowPanel.ArrangeItems(Rectangle rowRect, SpreadsheetPaint paint)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.ArrangeRows(SpreadsheetPaint paint)
   at Syncfusion.Windows.Forms.CellGrid.VisualContainer.OnPaint(PaintEventArgs e)
   at Syncfusion.Windows.Forms.Spreadsheet.VisualContainerExt.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
   at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
   at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
   at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.ScrollableChildFrame.WndProc(Message& m)
   at Syncfusion.Windows.Forms.CellGrid.SelectionPanel.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



Open the file in Excel

Problem1 (attached image)

Attachment: SpreadsheetCorruption_fcc186be.zip


AR Arulpriya Ramalingam Syncfusion Team February 10, 2020 01:39 PM UTC

Hi Spotty, 
 
Thank you for the update. 
 
We have tested the provided workbook and we got an unhandled argument exception and not the NullReferenceException. So, we have forwarded the scenario to our development team for further analysis to check possible cases of the reported use case. We will update you the proper details on 12th February. 
 
Regards, 
Arulpriya 



AR Arulpriya Ramalingam Syncfusion Team February 11, 2020 01:36 PM UTC

Hi Spotty, 
 
Thank you for your patience. 
 
We have checked the null exception issue in Spreadsheet and corruption issue while opening in MS Excel with our sample based on the given replication procedure. But we were unable to reproduce the issue. Please find the video link for your reference, 
 
 
Also the Argument exception which was mentioned in the previous update is an internal exception which is already handled in our source itself. Hence, if you still face the null exception, update us with spreadsheet settings that causes the issue and machine configuration details. 
 
Regards, 
Arulpriya 



SP Spotty February 12, 2020 12:52 AM UTC

So are you telling me that you have been unable to repro any problems with opening up the spreadsheet and making changes and the behaviour works in the same way as Excel.   As I have conflicting responses - saying you had found an issue and then its already handled in the code.

I'm using the latest Nuget package and clearly am still running into some issue that corrupts the file when used in Syncfusion spreadsheet that does not occur in Excel.     I can provide you with a Source project please PM for source details.


AR Arulpriya Ramalingam Syncfusion Team February 12, 2020 12:21 PM UTC

Hi Spotty, 
 
Thank you for the update. 
 
We have created a new incident under your Direct trac account to follow up with this query. Please upload the files in the ticket and its private ticket. Make use of the below link to log in. 
 
 
Regards, 
Arulpriya 


Loader.
Live Chat Icon For mobile
Up arrow icon