Hello!
I have just started to work with the Infragistics.Documents.Word namespace.
I tried to create a simple document using the following code:
Dim doc as new Infragistics.Documents.Word.Document
doc.save(filename)
This code creates a file but it also generates an exception. The exception is of type
"The type initializer for MS.Utility.EventTrace threw an exception"
I have implemented code that creates some text inside the document but that isn't included when it is saved. So something is wrong.
I am creating these files on a server with special rules of accesscontrol.
I am pretty sure that this has something to do with the server settings and not the Infragistics tools, but with an
exception like that, I am totally lost.
Someone out there who understands the problem?
/Henrik
Here comes a video. Unfortunately, the mouse over features weren't recorded.
The file names were as follows.
\\liab.lindab.com\AppSpace\XBOW\Projects\SE\2015\15-1028\1A\3. Offers\OpenAndCreate.txt
\\liab.lindab.com\AppSpace\XBOW\Projects\SE\2015\15-1028\1A\3. Offers\create.txt
\\liab.lindab.com\AppSpace\XBOW\Projects\SE\2015\15-1028\1A\3. Offers\excel.xls
\\liab.lindab.com\AppSpace\XBOW\Projects\SE\2015\15-1028\1A\3. Offers\word.doc
Exception: The type initializer for 'MS.Utility.EventTrace' threw an exception.
ex.StackTrace.ToString " at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID) at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming) at Infragistics.Documents.Core.Packaging.PackageFactory.Open(Stream stream, FileMode packageMode) at Infragistics.Documents.Word.WordprocessingMLWriter.Open(Stream stream, IPackageFactory packageFactory) at Infragistics.Documents.Word.Document.SaveHelper(Stream stream) at Infragistics.Documents.Word.Document.Save(String filename) at XBOW.DB.FileManager.CreateOffer() in C:\Users\LPHB\Documents\Visual Studio 2010\Projects\XBOW\XBOWclient\Classes\General\FileManager.vb:line 662" String
I hope it helps...
Hello Henrik,
Thank you for posting in our forum.
What we found is that our Word engine use FileStream with FileMode parameter set as OpenOrCreate, while same parameter in Excel engine is set to Create. To test if this rise the exception you are receiving I have implement a small sample project. This project creates two text documents. First with FileMode set to OpenOrCreate and second with same parameter set to Create. Please run this sample and try to create this two files on your server. Please let me know if you receive the same exception.
Please note, in order to be able to investigate this issue in deeper details I will need a little bit more information
- Can you send me the entire exception stack?
- From your post I have understood that you were able to create the Word file on your server. You received the exception after the file was created. Is this correct?
Waiting for your feedback.
I am currently investigating this behavior with our Development Team, because I think that this is a issue. As soon I got more concrete information about it, I will get back to you.
Thank you for your patience and understanding.
"Requested registry access is not allowed" shows up as inner exception. TypeInitialaztionException.
Gives better information...