locked
Getting WinRT concurrency exception in Windows 8 app in VS Express but not Professional

    Question

  • I have been working on a version of my XNA tutorial using DirectX 11 and XAML and have been having a pretty good go at things in general.

    Today, the trial version of VS 2012 Professional expired so I threw an install of the Express Edition on to make sure everything I had done up to this point would build/run ok. Turns out it doesn't though.

    In the section of my code where I am loading in vertex/pixel shaders I am using concurrency Tasks. Using Visual Studio 2012 Professional, this was all working great, but when I try to run the same project using Express Edition, I get the following exception:

    First-chance exception at 0x76BA4B32 (KernelBase.dll) in Demo.exe: 0x40080201: WinRT originate error (parameters: 0x800700A1, 0x00000075, 0x0299DA88).

    Here is the offending code block:

    auto loadVSTask = DX::ReadDataAsync(m_vertex).then([=](const Platform::Array<byte>^ bytecode) { DX::ThrowIfFailed( device->CreateVertexShader( bytecode->Data, bytecode->Length, nullptr, &m_vertexShader ) ); DX::ThrowIfFailed( device->CreateInputLayout(m_layout, m_layoutElements, bytecode->Data, bytecode->Length, &m_inputLayout) );

    });

    // Function that reads from a binary file asynchronously.
    inline Concurrency::task<Platform::Array<byte>^> ReadDataAsync(Platform::String^ filename)
    {
    using namespace Windows::Storage;
    using namespace Concurrency;

    auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation;

    return create_task(folder->GetFileAsync(filename)).then([] (StorageFile^ file) 
    {
    return FileIO::ReadBufferAsync(file);
    }).then([] (Streams::IBuffer^ fileBuffer) -> Platform::Array<byte>^ 
    {
    auto fileData = ref new Platform::Array<byte>(fileBuffer->Length);
    Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(fileData);
    return fileData;
    });
    }

    Using a non Async verison of the file loading works fine and everything runs perfectly. To reiterate this only happens in Visual Studio 2012 Express and does not occur in the Professional Edition.

    Any ideas?


    XNA Game Development Tutorials: http://www.thehazymind.com/xna


    Saturday, September 29, 2012 3:08 PM

Answers

  • The issue seems to be related to the directory separator I used. Changing them from / to \\ in the file path makes things work in all versions. Not sure how the / was working before with no issues or why it would matter between Express and Professional.

    XNA Game Development Tutorials: http://www.thehazymind.com/xna

    Saturday, September 29, 2012 6:34 PM