C# 仅在Windows Phone目标中使用0x8007007E 我将目标指向一个C语言应用程序,它的UWP C++通用的Windows项目引用是在同一个解决方案中。此应用程序在Windows桌面中正常工作,没有任何错误,但当我尝试在Windows Phone设备上运行它时,出现以下错误: System.IO.FileNotFoundException: The specified module could not be found. >(Exception from HRESULT: 0x8007007E) at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD) at *CALLED METHOD HERE* at Demo.MainPage..ctor()'Demo.exe' (Win32): Loaded
我已经检查了csproj,看看它是否直接引用了wincmd文件或dll,但它确实引用了其他项目 我已尝试检查设备存储,但找不到方法查看设备中已部署的应用程序内容 目标平台版本/分钟。版本:10.0.14393.0 编辑1: 看起来问题在于生成的DLL引用的是UCRTBASE.DLLC# 仅在Windows Phone目标中使用0x8007007E 我将目标指向一个C语言应用程序,它的UWP C++通用的Windows项目引用是在同一个解决方案中。此应用程序在Windows桌面中正常工作,没有任何错误,但当我尝试在Windows Phone设备上运行它时,出现以下错误: System.IO.FileNotFoundException: The specified module could not be found. >(Exception from HRESULT: 0x8007007E) at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD) at *CALLED METHOD HERE* at Demo.MainPage..ctor()'Demo.exe' (Win32): Loaded,c#,c++,uwp,windows-10-universal,C#,C++,Uwp,Windows 10 Universal,我已经检查了csproj,看看它是否直接引用了wincmd文件或dll,但它确实引用了其他项目 我已尝试检查设备存储,但找不到方法查看设备中已部署的应用程序内容 目标平台版本/分钟。版本:10.0.14393.0 编辑1: 看起来问题在于生成的DLL引用的是UCRTBASE.DLL File Type: DLL Image has the following dependencies: api-ms-win-core-com-l1-1-1.dll api-ms-win-c
File Type: DLL
Image has the following dependencies:
api-ms-win-core-com-l1-1-1.dll
api-ms-win-core-debug-l1-1-1.dll
api-ms-win-core-synch-l1-2-0.dll
api-ms-win-core-synch-l1-2-1.dll
api-ms-win-core-sysinfo-l1-2-1.dll
vccorlib140d_app.DLL
MSVCP140D_APP.dll
ADVAPI32.dll
VCRUNTIME140D_APP.dll
ucrtbased.dll
api-ms-win-core-winrt-string-l1-1-0.dll
api-ms-win-core-util-l1-1-0.dll
api-ms-win-core-winrt-error-l1-1-1.dll
api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-1.dll
api-ms-win-core-string-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-2.dll
api-ms-win-core-winrt-l1-1-0.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-libraryloader-l1-2-0.dll
api-ms-win-core-interlocked-l1-2-0.dll
api-ms-win-core-heap-l1-2-0.dll
api-ms-win-core-memory-l1-1-2.dll
编辑2:
Visual Studio将ucrt/arm路径包括为库路径。我正在使用Visual Studio 2017
LibraryPath = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\lib\ARM\store;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\atlmfc\lib\ARM;;C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\VS\lib\ARM;;C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\ucrt\arm;;;C:\Program Files (x86)\Windows Kits\10\lib\10.0.14393.0\um\arm;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.2\lib\um\arm;;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Lib\um\arm
编辑3:
出于某种原因,似乎从某个地方继承了_ARM\u WINAPI\u PARTITION\u DESKTOP\u SDK\u AVAILABLE=1,允许ARM目标(所有项目)访问桌面API。这会引起问题吗
编辑4:
通过dumpbin/imports,我可以获得我的程序正在使用的基于UCRTBASE.dll的函数列表,其中大多数是stdlib函数:
ucrtbased.dll
10D0E7E4 Import Address Table
10D0F430 Import Name Table
0 time date stamp
0 Index of first forwarder reference
527 strcpy_s
523 strcat_s
69 __stdio_common_vsprintf_s
3B2 _wsplitpath_s
55F wcscpy_s
396 _wmakepath_s
174 _initterm_e
33C _wassert
175 _invalid_parameter
5 _CrtDbgReportW
562 wcslen
52C strlen
47F free
4DC mbstowcs_s
526 strcpy
53A strtol
CD _difftime64
296 _mktime64
6A __stdio_common_vsscanf
575 wcstombs
500 realloc
3C2 _wtoi
54F toupper
36 __acrt_iob_func
173 _initterm
4FE rand
410 ceil
44A exit
166 _gmtime64_s
318 _time64
4D3 malloc
E0 _errno
3D0 abort
52F strncmp
12C _ftime64
55C wcscmp
11D _free_dbg
203 _malloc_dbg
4 _CrtDbgReport
A2 _callnewh
2BD _seh_filter_dll
B7 _configure_narrow_argv
170 _initialize_narrow_environment
171 _initialize_onexit_table
2B1 _register_onexit_function
E6 _execute_onexit_table
C3 _crt_atexit
C2 _crt_at_quick_exit
A5 _cexit
5D __stdio_common_vfprintf
当前怀疑:依赖于ADVAPI32.dll的使用。因此,我的堆栈中的罪魁祸首是:ADVAPI32.dll 我使用了一个加载SystemFunction036(RtlGenRandom)的依赖项,解决方案是重新编写代码,使用一个等效的UWP函数来完成同样的工作
微软真的应该重新考虑他们向开发者报告此类问题的方式,因为异常似乎与问题完全无关。一个简单的异常告诉我们ADVAPI32.dll是加载UWP移动变体中不允许的函数的罪魁祸首。由于这是一个运行时问题,您的代码在编译时会很好,除非您进行测试,否则您永远不会知道您的代码不会工作。的可能副本,所以您是说这是未解决的未解释答案的可能副本?有两个人在那里评论两个不同的问题,作者选择他的回答作为答案,但是它没有解释如何解决这个问题,声称这是微软的一个bug。我正在目标设备10.0.14393.0中使用最新版本。如果这是一个bug,您能解释一下我如何避免它,以及如何确保我的应用程序不包含ucrt引用吗?