0

I am trying to reproduce a WinML tutorial described in https://learn.microsoft.com/en-us/windows/ai/windows-ml/get-started-desktop and need help in resolving the "Access violation reading location" error while loading the model.

Installed Visual studio 2017, Windows 10, build version 17763 and followed the instructions in the tutorial. Wondering if it could be due to access control issue, I tried placing the ONNX file in multiple locations, even inside the solution folder, tried on Debug x64 and x86 flavor, changed the file permission, but still does not work.

void LoadModel()
{
    // load the model
    printf("Loading modelfile '%ws' on the '%s' device\n", modelPath.c_str(), deviceName.c_str());
    DWORD ticks = GetTickCount();
    model = LearningModel::LoadFromFilePath(modelPath);  //FAILS here.
    ticks = GetTickCount() - ticks;
    printf("model file loaded in %d ticks\n", ticks);
}

I expected the LearningModel::LoadFromFilePath(modelPath); to succeed and return a valid handle.

After further debugging, WINRT_RoGetActivationFactory in the below code returns REGDB_E_CLASSNOTREG Class not registered

namespace winrt
{
    template <typename Interface = Windows::Foundation::IActivationFactory>
    impl::com_ref<Interface> get_activation_factory(param::hstring const& name)
    {
        void* result{};
        hresult hr = WINRT_RoGetActivationFactory(get_abi(name), guid_of<Interface>(), &result);

1 Answers1

0

the error message "REGDB_E_CLASSNOTREG" isn't about the filename, it's about not being able to find the implementation of the LearningModel object. (if there were file issues, you'd get a file not found error or some other string.) Please ensure that you have the right SDK (Windows SDK, build 17763 or later) and Windows OS version (Windows 10, version 1809 or later).