IsolatedStorageException caused by lack of evidence on AppDomain when using OpenXml

947 views
Skip to first unread message

Gareth Hayter

unread,
May 19, 2016, 5:26:21 PM5/19/16
to Excel-DNA
Hi Govert

I use DocumentFormat.OpenXml to work with certain aspects of files.

An IsolatedStorageException is thrown when disposing this object (for large Excel files only): "Unable to determine the identity of domain"

It is caused by a Microsoft bug, due to a different code-path being used for large files.

It seems that evidence needs to be supplied to the AppDomain.

Suggested fixes:

Microsoft 'Won't Fix': 
The code that I'm using that causes the exception on Dispose() is:

using (var doc = DocumentFormat.OpenXml.Packaging.SpreadsheetDocument.Open(SavedFilePath, true))
{
   
.....
}


How do you suggest that I proceed?

Kind regards,
Gareth.


Govert van Drimmelen

unread,
May 19, 2016, 5:58:59 PM5/19/16
to exce...@googlegroups.com
Hi Gareth,

Have you tried this fix referred in the Connect issue, or are you running a version that's newer than this: https://support.microsoft.com/en-us/kb/2996566 ?

I guess you could try make your own AppDomain for this.

Finally, you might experiment with a custom version of Excel-DNA, where you add the evidence in ExcelDna.Loader.AppDomainHelper.CreateFullTrustSandbox(). If it works and does not seem to cause trouble, I can have a looked at incorporating such a change.

I had great trouble getting the AppDomain set up stuff to be reliable, e.g. working when the add-in is loaded over a network. I'd not be keen to revisit it myself.

-Govert




From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Gareth Hayter [gareth...@gmail.com]
Sent: 19 May 2016 11:26 PM
To: Excel-DNA
Subject: [ExcelDna] IsolatedStorageException caused by lack of evidence on AppDomain when using OpenXml

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Govert van Drimmelen

unread,
May 19, 2016, 6:06:28 PM5/19/16
to Excel-DNA
The comments in one of the articles (http://rekiwi.blogspot.co.za/2008/12/unable-to-determine-identity-of-domain.html ) show how you can update the evidence for the current AppDomain via reflection.

If we were to add it to the Excel-DNA AppDomain setup, if should probably be behind a flag, like ShadowCopyFiles is now.

-Govert
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+unsubscribe@googlegroups.com.

Ken

unread,
Nov 16, 2016, 4:17:09 PM11/16/16
to Excel-DNA
Govert
 
I am having the same issue as Gareth with lack of security evidence when using OpenXML on large Excel files. I get the IsolatedStorageException - "Unable to determine the identity of domain" when the file stream is being saved to disk. I was able to update the security evidence for the AppDomain as per Tim Lewis' suggested fix: http://stackoverflow.com/a/31118592/4009659 and my solution was working fine on my machine running in Visual Studio. However, the exception resurfaced when I tried to run my app from the packed XLL. I'm thinking it has something to do with the packed XLL. Rather than create a new AppDomain and assign evidence. I think it would be better to update the AppDomain being used by ExcelDNA and provide the required evidence. Please advise. 

Ken

unread,
Nov 16, 2016, 7:34:26 PM11/16/16
to Excel-DNA
To get around this dilemma, I removed the DLL requiring evidence for isolated storage from the .dna file and loaded it separately with LoadLibrary. But I would prefer a clean solution using the packed XLL for all the library references.
Reply all
Reply to author
Forward
0 new messages