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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





141716 Dec 30,2018 05:02 PM UTC Feb 12,2020 12:21 PM UTC WinForms 12
Tags: Spreadsheet
Asked On December 30, 2018 05:02 PM UTC

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
    End Sub

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

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    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
Restart app click button1 - doesnt load

  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

Replied On 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

Arulraj A [Syncfusion]
Replied On 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. 
Arulraj A  

Replied On 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.

  Message=One or more errors occurred.
   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

Arulraj A [Syncfusion]
Replied On 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. 

Arulraj A  

Arulraj A [Syncfusion]
Replied On 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.  

Arulraj A   

Arulraj A [Syncfusion]
Replied On 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. 
Arulraj A 

Arulpriya Ramalingam [Syncfusion]
Replied On 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 ( 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. 

Replied On 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 - 

  Message=Object reference not set to an instance of an object.
   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

Arulpriya Ramalingam [Syncfusion]
Replied On 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. 

Arulpriya Ramalingam [Syncfusion]
Replied On 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. 

Replied On 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.

Arulpriya Ramalingam [Syncfusion]
Replied On 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. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon