Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: "Operation could destabilize the runtime" when running in Medium Trust #2

Closed
ksouthworth opened this issue Jan 25, 2010 · 4 comments

Comments

@ksouthworth
Copy link

I'm calling the "CsvWriter.WriteRecords()" function from an ASP.NET IHttpHandler (.ashx) running in Medium Trust, and it's throwing this exception:

[VerificationException: Operation could destabilize the runtime.]
lambda_method(ExecutionScope , CsvWriter , UserInfo ) +51
System.Action2.Invoke(T1 arg1, T2 arg2) +0 CsvWriter.WriteRecords(IEnumerable1 records) +353

"UserInfo" is just a C# class of mine that holds some user properties (username, email, etc.)

@ksouthworth
Copy link
Author

[VerificationException: Operation could destabilize the runtime.]
   lambda_method(ExecutionScope , CsvWriter , UserInfo ) +51
   System.Action`2.Invoke(T1 arg1, T2 arg2) +0
   WA.FileHelpers.Csv.CsvWriter.WriteRecords(IEnumerable`1 records) +353

@ksouthworth
Copy link
Author

Also, this is how I'm calling the WriteRecords function:

                    MemoryStream memoryStream = new MemoryStream();
                    StreamWriter streamWriter = new StreamWriter(memoryStream);
                    using (var csvWriter = new CsvWriter(streamWriter))
                    {
                        csvWriter.WriteRecords(storeCustomers);
                    }                    
                    StreamReader streamReader = new StreamReader(memoryStream);
                    string csvOutput = streamReader.ReadToEnd();      

@ksouthworth
Copy link
Author

never mind, it had something to do with how i was opening/closing the streams/readers

@JoshClose
Copy link
Owner

OK. Closing.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants