Profiling causes Exception

dexit2kdexit2k Posts: 3
edited July 18, 2014 9:49AM in ANTS Performance Profiler 8
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:
2yfo5a.png

The code in ICSharpCode.SharpZipLib
1smpwr.png


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?

Comments

Sign In or Register to comment.