[Mono-list] Invalid IL code error when using openxml sdk in mono

Max nash12 at gmail.com
Thu Aug 11 11:20:01 EDT 2011


Hello there,

I am trying to run a simple commandline application written in C# on
mono using the openxml sdk
(http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124).

Upon executing the .exe with

/opt/mono-2.10/bin/mono ParseWord.exe

I get this error:

Unhandled Exception: System.InvalidProgramException: Invalid IL code
in System.IO.Packaging.Package:Open
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare):
method body is empty.

  at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore
(System.String path, Boolean readWriteMode) [0x00000] in <filename
unknown>:0
  at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open
(System.String path, Boolean isEditable,
DocumentFormat.OpenXml.Packaging.OpenSettings openSettings) [0x00000]
in <filename unknown>:0
  at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open
(System.String path, Boolean isEditable) [0x00000] in <filename
unknown>:0
  at ParseWord.Program.Main (System.String[] args) [0x00000] in
<filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException:
Invalid IL code in System.IO.Packaging.Package:Open
(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare):
method body is empty.

  at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore
(System.String path, Boolean readWriteMode) [0x00000] in <filename
unknown>:0
  at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open
(System.String path, Boolean isEditable,
DocumentFormat.OpenXml.Packaging.OpenSettings openSettings) [0x00000]
in <filename unknown>:0
  at DocumentFormat.OpenXml.Packaging.WordprocessingDocument.Open
(System.String path, Boolean isEditable) [0x00000] in <filename
unknown>:0
  at ParseWord.Program.Main (System.String[] args) [0x00000] in
<filename unknown>:0

Some code from my cli app:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;

namespace ParseWord
{
    class Program
    {
        static void Main(string[] args)
        {
            string docName = "Test_2.docx";

            if (!File.Exists(docName))
            {
                return;
            }

            using (WordprocessingDocument wdDoc =
WordprocessingDocument.Open(docName, true))
            {
                ...
            }
        }
    }
}

Is there any workaround for this or is it just impossible to use the
openxml sdk on mono?

Thanks!


More information about the Mono-list mailing list