Word range.ListFormat.ConvertNumbersToText Outofmemory

David Andrews 1 Reputation point
2022-11-18T11:47:37.827+00:00

Hello Forums,

I am supporting a legacy VSTO word plugin written in C#

The code for this plugin has not changed for more than 12 months - but in he last couple of weeks we are facing random out of memory failiures when processing list items from a document.

The error is
System.OutOfMemoryException: Insufficient memory to continue the execution of the program. at Microsoft.Office.Interop.Word.ListFormat.ConvertNumbersToText(Object& NumberType)

The code snippet where the failiure happens is

 easypqqDocument.thisDocument.Activate();  
 range.ListFormat.ConvertNumbersToText();  
 range.Copy();  
 easypqqDocument.thisDocument.Undo();  
 Log.Debug("Copied range to clipboard");  

It is not happening on every PC where the plugin is installed - even if you process the same document.

I have compared Windows Versions, Office Versions, dot.net versions and the plugin version between the pcs and they appear identical - installed memory is upwards of 16GB on all machines also.

The size of the document does not make a difference either - a test document with just some headers and 1 list item will also fail when hitting the above code on a "bad" PC but will not on the ones that work.

It feels like a configuration/settings issue - but its very hard to nail it down as I cant debug inside of the ListFormat.ConvertNumbersToText() function.

Any one seen/solved an issue like this before and got some pointers for debugging further?

Thanks in advance.
Dave

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,694 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Oskar Shon 866 Reputation points MVP
    2022-11-18T15:23:11.287+00:00

    did you set range as table's cell or paragraph?
    undo after copy... copy do not change anything so for what?

    I do not understand you instructions.

    0 comments No comments