DLL fails to load if unused ref class is removed

  • Thread starter Thread starter Clemens Arth
  • Start date Start date
C

Clemens Arth

Guest
I'm running into a very strange problem trying to compile and use a windows runtime component within an UWP application (VS2017 community 15.9.13 with NetCore.UniversalWindowsPlatform 6.2.8, compiled without /clr but with /ZW).

It is basically something like the GrayscaleTransform found in the UWP samples. The runtime component is actually working as expected, now I wanted to remove some unused code. However, as soon as I remove it from a particular file and recompile, it indeed compiles, links, but the DLL does not load any more.

Here's some example code that I have to put in:


ref class DummyU sealed {
public: DummyU() {}
};
DummyU^ CreateDummyU() {
return ref new DummyU();
}

The code just makes it work, although it is a) not referenced at all and b) does not do anything useful.

The result of removing it:


Exception thrown at 0x0EFF322F (vccorlib140d_app.dll) in TestAppUWP.exe: 0xC0000005: Access violation reading location 0x00000000.




in


STDAPI DllGetActivationFactory(_In_ HSTRING activatibleClassId, _Deref_out_ IActivationFactory** ppFactory) {
return Platform::Details::GetActivationFactory(Microsoft::WRL::Details::ModuleBase::module_, activatibleClassId, ppFactory);
}


function in dllexports.cpp which is part of VS. The module_ becomes NULL.

Does anyone have an idea if there are any known bugs with respect to the windows runtime not being initialized/used properly if there is no explicit instantiation of a ref class in a file?

Continue reading...
 
Back
Top