Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Achilleus  
#1 Posted : Monday, January 26, 2015 12:54:49 PM(UTC)
Achilleus

Rank: Newbie

Groups: Member
Joined: 1/26/2015(UTC)
Posts: 3

Hello all,

I've inherited a C# project that uses the GraphicsMill library, and have come up on a problem that only occurs when running in the compiler (VS2012, 2013 or 2015 all do the same). It is part of a huge project but I have re-created the identical error in a small test project as follows. I am stumped because I cannot now debug the project, though it runs ok outside of the compiler. The error occurs all the time in the inherited project, and only some of the time in small test projects; i.e. it seems somewhat random. This behavior suggests to me that it is a memory problem that acts randomly - for example if a resource is released earlier and then used later. I assume that the GraphicsMill uses non-managed code somewhere along its path.

To reproduce the error I created the following function, which can be run in a simple WPF application with a single button click. Threading is not used in my inherited project, but a single call in this test project does not produce the error, nor does a non-threaded loop of 100 iterations. But the tasked version here does produce the error.

The error only occurs under 64 bit mode. In 32 bit mode, the program works fine even in the compiler.

AurgumentException: "Parameter is not valid"

at System.Drawing.Bitmap.SetResolution(Single xDpi, Single yDpi)

at Aurigma.GraphicsMill.Bitmap.ToGdiPlusBitmap()

at OwMap.API.Test.MainWindow.<TestAurigmaClick>b__7() in c:\FlowMaps\OwMap\OwMap.API.Test\MainWindow.xaml.cs:line 249

at System.Threading.Tasks.Task.Execute()

Code:
using OwMap.API.Helpers;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using Aurigma.GraphicsMill;

// Snipped xaml and irrelevant code

private void TestAurigmaClick(object sender, RoutedEventArgs e)
    {
      for (int i = 0; i < 100; ++i)
      {
        Title = i.ToString();
        Task.Factory.StartNew(() =>
        {
          Aurigma.GraphicsMill.Bitmap aurigmaBitmap = new Aurigma.GraphicsMill.Bitmap(800, 600, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb, RgbColor.Red);
          System.Drawing.Bitmap windowsBitmap = aurigmaBitmap.ToGdiPlusBitmap();
          if (windowsBitmap == null)
            Console.WriteLine("bitmap is null");
          else
            Console.WriteLine("bitmap created");
        });
      }
    }

Output (results vary from run to run):

...

bitmap created

bitmap created

A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll

bitmap created

bitmap created

...

Aurigma.GraphicsMill.dll version is: 7.2.20.0

.Net framework tested on 4.0, 4.5 and 4.5.1. Results are identical.

If there is any additional information that I can provide, please let me know.

Many thanks for any help.

Fedor  
#2 Posted : Tuesday, January 27, 2015 3:05:14 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Thank you for the bug report.

Unfortunately I can't reproduce the problem. Could you attach the sample project? Which OS do you use?

Thank you fro your help.

Best regards,

Fedor Skvortsov

Achilleus  
#3 Posted : Tuesday, January 27, 2015 4:27:11 AM(UTC)
Achilleus

Rank: Newbie

Groups: Member
Joined: 1/26/2015(UTC)
Posts: 3

Originally Posted by: Fedor Go to Quoted Post
Thank you for the bug report.

Unfortunately I can't reproduce the problem. Could you attach the sample project? Which OS do you use?

Thank you fro your help.

Thanks for trying. Edit: I've attached (in the following post) a zipped solution that shows the error.[/i]

OS is Windows 7 Enterprise, SP1, 64 bit.

Edited by user Tuesday, January 27, 2015 4:16:03 PM(UTC)  | Reason: Not specified

Achilleus  
#4 Posted : Tuesday, January 27, 2015 4:11:24 PM(UTC)
Achilleus

Rank: Newbie

Groups: Member
Joined: 1/26/2015(UTC)
Posts: 3

Attached is a zipped solution which you can run in Visual Studio 2012.

Thanks for looking at this. It only fails when running in the compiler.

Edited by user Tuesday, January 27, 2015 4:16:25 PM(UTC)  | Reason: Not specified

Fedor  
#5 Posted : Wednesday, January 28, 2015 3:59:53 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Unfortunately I could reproduce the problem neither with my nor with the provided project. I have tried with the same configuration as well as with different versions of Visual Studio and Windows.

Could you test it on other machines? What hardware do you use?

You can submit a case if it is more convenient for you.

P.S. I have deleted the provided project as it contained the production license key.

Edited by user Wednesday, January 28, 2015 4:15:00 AM(UTC)  | Reason: Not specified

Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.