[Insight-users] File:dbgheap.c problem when using ITK in C++/CLI

Dan Mueller dan.muel at gmail.com
Tue Aug 25 07:11:05 EDT 2009


Hi Hossein,

It seems the project is not correctly configured. Please read the
following references:
    http://public.kitware.com/pipermail/insight-users/2006-October/019652.html
    http://www.cmake.org/pipermail/insight-users/2007-September/023670.html
    http://www.itk.org/Wiki/ITK_FAQ#Deal_with_Runtime_Exceptions_in_a_Managed_C.2B.2B_Windows_Forms_Application
    http://code.google.com/p/manageditk/

In summary:
1. Try to use CMake, it will make your life easier.
2. Place your ITK functionality in a separate DLL.

By the way: Is there a reason you are using ITK 2.8.1? This is ancient...

Hope this helps.

Regards, Dan

2009/8/24 Hossein Ghadiri <hossein.ghadiri at gmail.com>:
> Hi Dan
> Sorry for my bad explanation.
> This is my procedure:
> 1- In Microsoft visual studio 2005, I click "New Project" and in Visual C++
> project type, I select "Windows Form Application" from CLR.
> 2-In Properties window of project, I defined: Additional Include
> Directories, Additional Library Directories and Additional Dependencies in
> order to use ITK header and Libs.
> 3-Also in properties window, I change the "Common Language Runtime Support"
> to "/clr"
> 4- In Form1.h file I include itkImageSeriesReader.h like below:
> #pragma once
> #include "itkImageSeriesReader.h"
> namespace t {
>        using namespace System;
>        using namespace System::ComponentModel;
>        using namespace System::Collections;
>        using namespace System::Windows::Forms;
>        using namespace System::Data;
>        using namespace System::Drawing;
>
>        /// <summary>
>        /// Summary for Form1
>        ///
>        /// WARNING: If you change the name of this class, you will need to
> change the
>        ///          'Resource File Name' property for the managed resource
> compiler tool
>        ///          associated with all .resx files this class depends on.
> Otherwise,
>        ///          the designers will not be able to interact properly
> with localized
>        ///          resources associated with this form.
>        /// </summary>
>        public ref class Form1 : public System::Windows::Forms::Form
>        {
>        public:
>                Form1(void)
>                {
>                        InitializeComponent();
>                        //
>                        //TODO: Add the constructor code here
>                        //
>                }
> .
> .
> .
> .
> 5- at last I try to build and run.
>
> I attached project.
>
>
>
> -----Original Message-----
> From: Dan Mueller [mailto:dan.muel at gmail.com]
> Sent: Monday, August 24, 2009 7:08 PM
> To: Hossein Ghadiri
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] File:dbgheap.c problem when using ITK in
> C++/CLI
>
> Hi Hossein,
>
> I don't know what "create a simple project" means. It could be this
> step is causing the issue.
>
> As I said in my previous email: I think the best chance of getting
> help regarding this issue is to post detailed instructions (including
> code, project files, etc) on how to reproduce the issue. It sounds
> like the code file will be only 1 or 2 lines.
>
> Regards, Dan
>
> 2009/8/24 Hossein Ghadiri <hossein.ghadiri at gmail.com>:
>> Hi Dan,
>> Thank you for your reply,
>> I think my problem does not depend on my codes, because when I create a
> new
>> C++/CLI Window Form Application, and without writing any codes, and just
>> including itkImageSeriesReader.h, the error occurred.
>> I used ITK-3.12.0 with cmake and build with MS2005 again! And just create
> a
>> simple project and without writing any code, I just include
>> itkImageSeriesReader.h, and attached window come up when I run the
> program.
>> It may help you saying, when I include for example itkImage.h,
>> itkGDCMImageIO.h and itkGDCMSeriesFileNames.h, the program run without any
>> problem.
>> Here is the output window:
>> '001.exe': Loaded 'G:\QuCT\880524\004\debug\001.exe', Symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\mscoree.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', No symbols loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42
>> _x-ww_f75eb16c\msvcp80d.dll', Symbols loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42
>> _x-ww_f75eb16c\msvcr80d.dll', Symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42
>> _x-ww_f75eb16c\msvcm80d.dll', Symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\lpk.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded.
>> '001.exe': Loaded
>> 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll', No symbols
>> loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.1433_x-
>> ww_5cf844d2\msvcr80.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', No symbols loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.
>> 0.2600.5512_x-ww_35d4ce83\comctl32.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', No symbols loaded.
>> '001.exe': Loaded
>> 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll', No symbols
>> loaded.
>> '001.exe': Unloaded
>> 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Culture.dll'
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\32e6f703c114f3a971c
>> be706586e3655\mscorlib.ni.dll', No symbols loaded.
>> '001.exe' (Managed): Loaded
>>
> 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
>> , No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll', No symbols loaded.
>> '001.exe' (Managed): Loaded 'g:\QuCT\880524\004\debug\001.exe', Symbols
>> loaded.
>> '001.exe': Loaded
>> 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll', No symbols
>> loaded.
>> '001.exe': Loaded
>> 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll', No
> symbols
>> loaded.
>> '001.exe': Loaded 'C:\WINDOWS\system32\rsaenh.dll', No symbols loaded.
>> '001.exe' (Managed): Loaded
>>
> 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.DebugCRT_1fc8b3b9a1e18e3b_8.0.50727.42
>> _x-ww_f75eb16c\msvcm80d.dll', Symbols loaded.
>> '001.exe': Loaded
>>
> 'C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\ba0e3a22211ba7343e011
>> 6b051f2965a\System.ni.dll', No symbols loaded.
>> '001.exe' (Managed): Loaded
>>
> 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll',
>> No symbols loaded.
>> First-chance exception at 0x7c96c540 in 001.exe: 0xC0000005: Access
>> violation reading location 0xe6f9ff6c.
>> '001.exe': Loaded 'C:\WINDOWS\system32\xpsp2res.dll', Binary was not built
>> with debug information.
>> The program '[2592] 001.exe: Managed' has exited with code 0 (0x0).
>> The program '[2592] 001.exe: Native' has exited with code 0 (0x0).
>>
>> Regards Hossein
>>
>>
>> -----Original Message-----
>> From: Dan Mueller [mailto:dan.muel at gmail.com]
>> Sent: Saturday, August 22, 2009 7:22 PM
>> To: Hossein Ghadiri
>> Cc: insight-users at itk.org
>> Subject: Re: [Insight-users] File:dbgheap.c problem when using ITK in
>> C++/CLI
>>
>> Hi Hossein,
>>
>> It seems there is a memory corruption. It is difficult to diagnose the
>> issue without seeing any source code (and even with seeing the source
>> code it may be difficult to find).
>>
>> I recommend you write the simplest smallest program which reproduces
>> the issue, and post this to the mailing list.
>>
>> Regards, Dan
>>
>> 2009/8/22 Hossein Ghadiri <hossein.ghadiri at gmail.com>:
>>> Dear Luis
>>>
>>> Thank you very much, I found and download files.
>>>
>>> But, now I know I can use native ITK when I am programming in C++/CLI.
>>>
>>> So, If it is possible, help me in my way:
>>>
>>> I develop a CLI form application and decide to read dicom series and work
>>> with images and headers.
>>>
>>> I used ITK in my program and there are no error in compilation and
>> linking,
>>> but when I run the program, an Error Window come up including:
>>>
>>>
>>>
>>> Microsoft Visual C++ Debug Library
>>>
>>> Debug assertion Failed
>>>
>>> Program g:\QuCT\880524\debug\001.exe
>>>
>>> File:dbgheap.c
>>>
>>> Line:1414
>>>
>>> Expression: _CrtIsValidHeapPointer(pUserData)
>>>
>>>>>>
>>> Abort/Retry/Ignore
>>>
>>>
>>>
>>> And my program does not run.
>>>
>>>
>>>
>>> Please help
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ________________________________
>>>
>>> From: Luis Ibanez [mailto:luis.ibanez at kitware.com]
>>> Sent: Sunday, August 16, 2009 7:57 PM
>>> To: Hossein Ghadiri
>>> Cc: insight-users at itk.org
>>> Subject: Re: [Insight-users] I can not find "ManagedITK.Common.dl"l
>>>
>>>
>>>
>>> Hi Hossein,
>>>
>>>
>>> Have you tried downloading the binary build ?
>>>
>>> You can do that from:
>>>
>>>            http://code.google.com/p/manageditk/
>>>
>>> Look at the panel in the right hand side of the page above,
>>> and you will find the link to:
>>>
>>> http://manageditk.googlecode.com/files/ManagedITK-bin-x86-3.14.0.0.zip
>>>
>>>
>>>      Regards,
>>>
>>>
>>>             Luis
>>>
>>>
>>>
>>
> ----------------------------------------------------------------------------
>> -----
>>>
>>> On Sun, Aug 16, 2009 at 7:58 AM, Hossein Ghadiri
>> <hossein.ghadiri at gmail.com>
>>> wrote:
>>>
>>> Dear ITK users,
>>>
>>> As mentioned in Dan Mueller paper, for using Pre-Compiled assemblies, we
>> can
>>> add “ManagedITK.Common.dll” assembly as References to our C++/CLI
> project.
>>>
>>> I did download “ManagedITK-src-3.6.0.2.zip” from MIDAS Journal, but I can
>>> not find assemblies.
>>>
>>> Thanks in advance for any help
>>>
>>> Hossein
>


More information about the Insight-users mailing list