Excel recovery Error after saving File EPPLUS












0















I am using(learning) EPPLUS with VB.NET.

I first used a blank excel sheet and saved the file and it saved successfully.

But when I tried to insert data and save to my required Excel sheet(sheet with validations and formulas.) it don't save the file.



Same Excel sheet when used with Office.Interop library saves perfectly.But interop is slow in writing speed so I used EPPLUS.



Following is my code :



Dim a As String = "D:project1binDebugpro1NGSTR1.xlsx"
Dim b As String = "C:UsersadminDesktopNGSTR1.xlsx"

Dim file = New System.IO.FileInfo(a)
Dim file2 = New System.IO.FileInfo(b)



Using pck As New ExcelPackage(file)
Dim ws As ExcelWorksheet = pck.Workbook.Worksheets("b2b")
ws.Cells("A5").LoadFromDataTable(dt, False) '-----dt has the data
pck.Save()
'pck.SaveAs(file2) '-------- This isn't working either
End Using


After 2-3 minutes of process it shows the error



Errors I get are following :




Managed Debugging Assistant 'ContextSwitchDeadlock' :




'The CLR has been unable to transition from COM context 0x1bd79550 to COM context 0x1bd79428 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.'



Or Sometimes I get :




System.InvalidOperationException:




Error saving file D:project1binDebugpro1NGSTR1.xlsx



Inner Exception :




ArgumentException:




Column number out of bounds



So I searched the internet and found article on GitHub

Added the line pck.DoAdjustDrawings = False before pck.save



Now file getting saved but when I open the excel, it shows recovery message box.

On Yes in dialogbox I got the message




Removed Records: Named range from /xl/workbook.xml part (Workbook)











share|improve this question





























    0















    I am using(learning) EPPLUS with VB.NET.

    I first used a blank excel sheet and saved the file and it saved successfully.

    But when I tried to insert data and save to my required Excel sheet(sheet with validations and formulas.) it don't save the file.



    Same Excel sheet when used with Office.Interop library saves perfectly.But interop is slow in writing speed so I used EPPLUS.



    Following is my code :



    Dim a As String = "D:project1binDebugpro1NGSTR1.xlsx"
    Dim b As String = "C:UsersadminDesktopNGSTR1.xlsx"

    Dim file = New System.IO.FileInfo(a)
    Dim file2 = New System.IO.FileInfo(b)



    Using pck As New ExcelPackage(file)
    Dim ws As ExcelWorksheet = pck.Workbook.Worksheets("b2b")
    ws.Cells("A5").LoadFromDataTable(dt, False) '-----dt has the data
    pck.Save()
    'pck.SaveAs(file2) '-------- This isn't working either
    End Using


    After 2-3 minutes of process it shows the error



    Errors I get are following :




    Managed Debugging Assistant 'ContextSwitchDeadlock' :




    'The CLR has been unable to transition from COM context 0x1bd79550 to COM context 0x1bd79428 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.'



    Or Sometimes I get :




    System.InvalidOperationException:




    Error saving file D:project1binDebugpro1NGSTR1.xlsx



    Inner Exception :




    ArgumentException:




    Column number out of bounds



    So I searched the internet and found article on GitHub

    Added the line pck.DoAdjustDrawings = False before pck.save



    Now file getting saved but when I open the excel, it shows recovery message box.

    On Yes in dialogbox I got the message




    Removed Records: Named range from /xl/workbook.xml part (Workbook)











    share|improve this question



























      0












      0








      0








      I am using(learning) EPPLUS with VB.NET.

      I first used a blank excel sheet and saved the file and it saved successfully.

      But when I tried to insert data and save to my required Excel sheet(sheet with validations and formulas.) it don't save the file.



      Same Excel sheet when used with Office.Interop library saves perfectly.But interop is slow in writing speed so I used EPPLUS.



      Following is my code :



      Dim a As String = "D:project1binDebugpro1NGSTR1.xlsx"
      Dim b As String = "C:UsersadminDesktopNGSTR1.xlsx"

      Dim file = New System.IO.FileInfo(a)
      Dim file2 = New System.IO.FileInfo(b)



      Using pck As New ExcelPackage(file)
      Dim ws As ExcelWorksheet = pck.Workbook.Worksheets("b2b")
      ws.Cells("A5").LoadFromDataTable(dt, False) '-----dt has the data
      pck.Save()
      'pck.SaveAs(file2) '-------- This isn't working either
      End Using


      After 2-3 minutes of process it shows the error



      Errors I get are following :




      Managed Debugging Assistant 'ContextSwitchDeadlock' :




      'The CLR has been unable to transition from COM context 0x1bd79550 to COM context 0x1bd79428 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.'



      Or Sometimes I get :




      System.InvalidOperationException:




      Error saving file D:project1binDebugpro1NGSTR1.xlsx



      Inner Exception :




      ArgumentException:




      Column number out of bounds



      So I searched the internet and found article on GitHub

      Added the line pck.DoAdjustDrawings = False before pck.save



      Now file getting saved but when I open the excel, it shows recovery message box.

      On Yes in dialogbox I got the message




      Removed Records: Named range from /xl/workbook.xml part (Workbook)











      share|improve this question
















      I am using(learning) EPPLUS with VB.NET.

      I first used a blank excel sheet and saved the file and it saved successfully.

      But when I tried to insert data and save to my required Excel sheet(sheet with validations and formulas.) it don't save the file.



      Same Excel sheet when used with Office.Interop library saves perfectly.But interop is slow in writing speed so I used EPPLUS.



      Following is my code :



      Dim a As String = "D:project1binDebugpro1NGSTR1.xlsx"
      Dim b As String = "C:UsersadminDesktopNGSTR1.xlsx"

      Dim file = New System.IO.FileInfo(a)
      Dim file2 = New System.IO.FileInfo(b)



      Using pck As New ExcelPackage(file)
      Dim ws As ExcelWorksheet = pck.Workbook.Worksheets("b2b")
      ws.Cells("A5").LoadFromDataTable(dt, False) '-----dt has the data
      pck.Save()
      'pck.SaveAs(file2) '-------- This isn't working either
      End Using


      After 2-3 minutes of process it shows the error



      Errors I get are following :




      Managed Debugging Assistant 'ContextSwitchDeadlock' :




      'The CLR has been unable to transition from COM context 0x1bd79550 to COM context 0x1bd79428 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.'



      Or Sometimes I get :




      System.InvalidOperationException:




      Error saving file D:project1binDebugpro1NGSTR1.xlsx



      Inner Exception :




      ArgumentException:




      Column number out of bounds



      So I searched the internet and found article on GitHub

      Added the line pck.DoAdjustDrawings = False before pck.save



      Now file getting saved but when I open the excel, it shows recovery message box.

      On Yes in dialogbox I got the message




      Removed Records: Named range from /xl/workbook.xml part (Workbook)








      excel vb.net epplus






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 12:14







      Hitesh Shroff

















      asked Nov 21 '18 at 5:33









      Hitesh ShroffHitesh Shroff

      417




      417
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405788%2fexcel-recovery-error-after-saving-file-epplus%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53405788%2fexcel-recovery-error-after-saving-file-epplus%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          'app-layout' is not a known element: how to share Component with different Modules