Red Gate forums :: View topic - Profiling causes Exception
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Performance Profiler 8
ANTS Performance Profiler 8 forum

Profiling causes Exception

Search in ANTS Performance Profiler 8 forum
Post new topic   Reply to topic
Jump to:  
Author Message
dexit2k



Joined: 16 Jul 2014
Posts: 2

PostPosted: Wed Jul 16, 2014 11:45 am    Post subject: Profiling causes Exception Reply with quote

Hi Redgate!
When i am using the performance Profiles 8.6 with the open source project:
ICSharpCode.SharpZipLib

i get this exception: "Dieser Vorgang kann die Laufzeit destabilisieren." =>

"Operation could destabilize the runtime"
ICSharpCode.SharpZipLib.Zip.ZipOutputStream..ctor(Stream baseOutputStream) line 848

My Versions:


The code in ICSharpCode.SharpZipLib




Code:

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Zip;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var _zipfile = new FileInfo(@"D:\_test\zip\test.zip");
                var lDirectory = new DirectoryInfo(@"D:\_test\zip");
                var lStopWatch = new Stopwatch();

                var dd = lDirectory
                    .GetFiles("*.jpg")
                    .ToDictionary(p => p.FullName, LoadStream);

                lStopWatch.Restart();
                using (var lZipOutputStream = new ZipOutputStream(_zipfile.Create()))
                {
                    lZipOutputStream.SetLevel(0);
                   
                    foreach (var lS in dd)
                    {
                        var lEntry = new ZipEntry(lS.Key)
                                         {
                                             CompressionMethod = CompressionMethod.Stored,
                                             DateTime = DateTime.Now
                                         };
                        lZipOutputStream.PutNextEntry(lEntry);
                        lS.Value.Seek(0, SeekOrigin.Begin);
                        lS.Value.CopyTo(lZipOutputStream);
                    }
                }
                Console.WriteLine(lStopWatch.ElapsedMilliseconds);
                Console.ReadLine();
            }
            catch (Exception lEx)
            {
                Console.WriteLine(string.Format("Msg: {0}, Stacktrace: {1}", lEx.Message, lEx.StackTrace));
                Console.ReadLine();
            }
        }

        private static Stream LoadStream(FileInfo pFile)
        {
            var lRet = new MemoryStream();
            pFile.OpenRead().CopyTo(lRet);
            return lRet;
        }
    }
}


Do you have any solution?
Back to top
View user's profile Send private message
Chris.Allen



Joined: 12 Mar 2009
Posts: 594

PostPosted: Thu Jul 17, 2014 1:28 pm    Post subject: Reply with quote

Do you have: AllowPartiallyTrustedCallers set? If so, try with this removed.
Back to top
View user's profile Send private message
dexit2k



Joined: 16 Jul 2014
Posts: 2

PostPosted: Fri Jul 18, 2014 2:49 pm    Post subject: Reply with quote

Thank You very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group