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

Windows phone 8 Platform::COMException

Aug 8, 2013 at 8:12 PM
Edited Aug 8, 2013 at 8:13 PM
Hi I'm trying to use spriteBatch on Windows phone 8 and added the directxtk Project from Windows phone 8 simple, in the properties
C/C++
added this
DirectXTK\Inc;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)

I added the reference in the main Project.

in the linker input added

dxguid.lib
and when i try :

if(d3dDevice!=nullptr)
{
    DX::ThrowIfFailed(
        CreateDDSTextureFromFile(d3dDevice,  L"Assets/TextureTest.dds", nullptr, &m_Texture, MAXSIZE_T)
    );
}
I get an ugly Platform::Exception.
What am I doing wrong?

I come from xna and don't have much experience in c++ I've use direct2d succesfully but this is giving me a hard time.
Can any one help me?
Aug 8, 2013 at 8:16 PM
Edited Aug 8, 2013 at 8:32 PM
You may want to start with the DirectXTK SimpleSample for Windows phone 8

The details of what went wrong are covered in the HRESULT. The best thing to do is enable "break on C++ Exceptions" in the debugger and see where in the code it failed. Most likely something is wrong with your assets file location or the file is bad or missing in some way.

Also, What is "MAXSIZE_T"? You should pass a 0 by default or let the parameter default to 0 unless you have a specific size you are trying to enforce. Remember that the DDS file must contain mipmaps to be sure it contains a range of sizes to choose from if passing something other than 0 to this function.
Aug 8, 2013 at 9:13 PM
Yes i started with Dirextk SimpleSample for Windows phone 8

I activated de c++ Excetions and get this:

First-chance exception at 0x775C277C in SpriteBatchTest.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x0143E9EC. HRESULT:0x80070002

If there is a handler for this exception, the program may be safely continued.

I tried to sustitute MAXSIZE_T for a 0 and got the same.

The image is good i tried on the SimpleSample and it loads it no problem.

I stored the image in the assets folder in both solutions.

I'm gessing its something to do with the Project import?
Aug 9, 2013 at 6:12 AM
HRESULT 0x80070002 is Win32 File Not Found. That means that the TextureTest.dds is either not in your package, is not actually that name, or is in a different location. You can look in the GeneratedFiles folder of the build project and see what files are where in your package.

If there was a problem with the project import, you'd get link errors.
Aug 9, 2013 at 5:51 PM
Edited Aug 9, 2013 at 5:53 PM
Thank you very much for your help.
My GeneretedFiles folder was empty.
So I excluded the file from the Project, I deleted it from tmy Assets folder, I recopied it again in the Assets folder and from the Project I right clicked Add Existing Item and chose my Test Texture and it all worked.

I sincierly have no idea were I went wrong the first time but it just Works.
I started a new Project to make sure and got it to work the first time.

Thanks again for your help.
Aug 9, 2013 at 6:39 PM
Edited Aug 9, 2013 at 6:40 PM
God I can't get it to work.
Now it Works on my emulator but when I changed to device deploy I had to relink directxtk.
The Project deploy on my Nokia 520 now but draws nothing, just clears the screen.

And I have this ugly output:

'HitoDemoWP8.exe' (Win32): Loaded 'C:\Data\programs{BF453E53-CC1F-469B-BE7C-285EF2CEBF8B}\Install\HitoDemoWP8.exe'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\NTDLL.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\KERNELBASE.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\D3D11.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\COMBASE.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\PhoneAppModelHost.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Vccorlib110d.dll'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Msvcp110d.dll'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Msvcr110d.dll'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\MSVCRT.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\KERNEL32LEGACY.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\DXGI.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\USER32.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\GDI32.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\MINCOREDLOAD.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\RPCRT4.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\EMClient.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\CoreUI.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\TaskHostSvcs.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\OLEAUT32.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\ModernApiExtHost.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\SecRuntime.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\SECHOST.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\orientation.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\ShellChromeAPI.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\CRYPTBASE.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\BCRYPTPRIMITIVES.DLL'. Cannot find or open the PDB file.
The thread 0xbf8 has exited with code 0 (0x0).
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\AppModelCore.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\AppChromeAPI.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\PsmApp.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\WINTYPES.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\CRYPTSP.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\RSAENH.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\wpglobutil.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\ADVAPI32LEGACY.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\wpcoreutil.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\SSPICLI.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\PCWUM.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\AppModelProxy.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\NtUserSynchExtHost.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Windows.Phone.Devices.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\CFGMGR32.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\DXGIDebug.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\qcdx9um8930.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Msvcr110.dll'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\D3D10LEVEL9.DLL'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\qcvidum8930.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\d3d11_1SDKLayers.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\qca3xxcompiler8930.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\Msvcp110.dll'. Symbols loaded.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\CompClient.dll'. Cannot find or open the PDB file.
'HitoDemoWP8.exe' (Win32): Loaded '\Device\HarddiskVolume27\Windows\System32\WINDOWSCODECS.DLL'. Cannot find or open the PDB file.
D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]
The program '[1100] HitoDemoWP8.exe' has exited with code 0 (0x0).

What do I have to do to get it working on my phone?
Aug 9, 2013 at 10:40 PM
The output tells you what's wrong:
D3D11 WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader expects a Render Target View bound to slot 0, but none is bound. This is OK, as writes of an unbound Render Target View are discarded. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Render Target View here. [ EXECUTION WARNING #3146081: DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET]
The rest is just complaining about the lack of matching symbols for all the loaded components which appears to be expected.
Marked as answer by walbourn on 1/23/2014 at 11:26 PM
Aug 13, 2013 at 6:33 PM
Thank you very much walbourn for your patience. You've been very helpfull again, I'm the worst Reading logs.

I had a conceptual mismatch between setting a render target and presenting it.
I called m_spriteBatch->Begin(); before m_d3dContext->OMSetRenderTargets

I'll paste my render method just in case it's helpfull to anyone.,
void SpriteRenderer::Render()
{
    // Clear background with bg_color 

    const float bg_color[]={245.0f/255.0f, 241.0/255.0f, 196.0f/255.0f, 1.000f };
    m_d3dContext->ClearRenderTargetView(        
        m_renderTargetView.Get(),        
        bg_color );
    m_d3dContext->ClearDepthStencilView(        
        m_depthStencilView.Get(),        
        D3D11_CLEAR_DEPTH, 1.0f, 0 );

    
    m_d3dContext->OMSetRenderTargets(
        1,
        m_renderTargetView.GetAddressOf(),
        m_depthStencilView.Get()
        );

    m_spriteBatch->Begin();
    m_testCharacter->Draw(m_spriteBatch.get());
    m_spriteBatch->End();
}
Thank's again walbourn