Profiling causes Exception

Code profiling for .NET developers.

Moderator: dom.smith

Profiling causes Exception

Postby dexit2k » Wed Jul 16, 2014 11:45 am

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:
Image

The code in ICSharpCode.SharpZipLib
Image



Code: Select all
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?
dexit2k
 
Posts: 2
Joined: Wed Jul 16, 2014 11:18 am

Postby Chris.Allen » Thu Jul 17, 2014 1:28 pm

Do you have: AllowPartiallyTrustedCallers set? If so, try with this removed.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby dexit2k » Fri Jul 18, 2014 2:49 pm

Thank You very much!
dexit2k
 
Posts: 2
Joined: Wed Jul 16, 2014 11:18 am


Return to ANTS Performance Profiler 8

Who is online

Users browsing this forum: No registered users and 0 guests