This project has moved and is read-only. For the latest updates, please go here.

App crash (CreateWICTextureFromFile + VLD)

Feb 24, 2014 at 2:58 PM
In my project i'm using DirectXTK and Visual Leak Detector. When i put CreateWICTextureFromFile in code, compile it and run, i got:
Unhandled exception at 0x77493632 (ntdll.dll) in blahblahblah.exe: 0xC0000005: Access violation writing location 0x00000008.
The same is happening with CreateWICTextureFromMemory, but DDS loader works fine. All works fine when i put in comment VLD include. I'm using Visual Studion 2012 with latest DirectXTK and VLD.
Does anybody else having this problem and knows how to solve it? It's easily reproducible. Just put both libraries in empty win32 project, make a legit CreateWICTextureFromMemory call and run.
Feb 24, 2014 at 7:07 PM
With additional testing i figured out that it's something wrong with project settings. When i create empty Win32 project, app crash at startup. But when i create Win32 project with default settings, all works just fine. Does anybody knows why?
Ps: Same crash if i try to initialize EffectFactory. Other objects works fine.
Feb 24, 2014 at 11:03 PM
Is your application initializing COM via CoInitialize or CoInitializeEx?
Marked as answer by walbourn on 2/24/2014 at 3:03 PM
Feb 25, 2014 at 8:07 AM
Where do i check that? I don't use this COM initialization in my code. This exception throws before executes first line of code. Call stack:
ntdll.dll!77043632() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
vld_x86.dll!0320abf0()  Unknown
vld_x86.dll!0321e5cf()  Unknown
vld_x86.dll!0321e725()  Unknown
KernelBase.dll!75f8e7db()   Unknown
user32.dll!74a6159a()   Unknown
ntdll.dll!7702e0f4()    Unknown
user32.dll!74a607ef()   Unknown
user32.dll!74a5f513()   Unknown
user32.dll!74a5f4dd()   Unknown
user32.dll!74a5fcf0()   Unknown
user32.dll!74a605ac()   Unknown
user32.dll!74a5fd0f()   Unknown
ntdll.dll!770526e8()    Unknown
ntdll.dll!7705297b()    Unknown
ntdll.dll!7705481e()    Unknown
ntdll.dll!7705486b()    Unknown
ntdll.dll!77058176()    Unknown
ntdll.dll!77059eac()    Unknown
ntdll.dll!77057dfb()    Unknown
ntdll.dll!77066ea1()    Unknown
ntdll.dll!770539f0()    Unknown
ntdll.dll!77062c04()    Unknown
vld_x86.dll!0321faa6()  Unknown
vld_x86.dll!0321de49()  Unknown
KernelBase.dll!75f8e66a()   Unknown
vld_x86.dll!0321faa6()  Unknown
vld_x86.dll!0321faa6()  Unknown
vld_x86.dll!0321faa6()  Unknown
vld_x86.dll!0321def7()  Unknown
I have also checked VLD source for CoInitialize and i did not find it. The same exception is thrown if i create empty Win32 project, add cpp file, copy code from Simple Win32 Sample, add vld.h include and run. Do you think it's more appropriate to contact VLD creators?
Feb 25, 2014 at 9:02 PM
Firstly, set up the Microsoft Symbol Server so you get more useful stacks.

If you are using WIC, you are expected to call CoInitialize() or CoInitializeEx() in your Win32 application. This should resolve issues once you start calling DirectXTK interfaces.

If you are getting issues before your application's main() function, that might be VLD... It's certainly not DirectXTK.
Feb 26, 2014 at 10:13 AM
Thanks for the tip about symbol server. I know of his existence but never use it.
After one additional day of problem solving i manage to resolve my issue. It was VLD fault. I was using not so latest VLD v2.3 installer, which has still some bugs in it. I manually build VLD source (this is the latest library version) and use it and then all works without a problem.
Marked as answer by Tanq on 2/26/2014 at 2:14 AM