简体   繁体   English

运行Windows Phone 8应用程序时出现System.IO.FileNotFoundException错误

[英]System.IO.FileNotFoundException error when running Windows Phone 8 application

I have a Windows Runtime Component that uses some native libraries ( the PJSIP library ). 我有一个Windows运行时组件,它使用一些本机库( PJSIP库 )。 This component is used in a Windows Phone 8 Application and when I try to invoke a function from the native component I get the following error: 此组件用于Windows Phone 8应用程序,当我尝试从本机组件调用函数时,我收到以下错误:

An exception of type 'System.IO.FileNotFoundException' occurred in TestingApp.DLL but was not handled in user code

with the Source (at Exception Details) in mscorlib. 使用mscorlib中的Source(在Exception Details)。

Can anyone point out what may be causing this error and how can I find out what is missing actually? 任何人都可以指出可能导致此错误的原因,我怎样才能找出实际缺失的内容? When I try to put a breakpoint in my Windows Runtime Component, at runtime, the breakpoint appears as disabled. 当我尝试在Windows运行时组件中放置断点时,在运行时,断点显示为已禁用。

Regards, Tamas 此致,Tamas

Add the missing dll to the project (like adding a new file) and mark it as content. 将缺少的dll添加到项目中(如添加新文件)并将其标记为内容。 Then reference the dll from this location. 然后从这个位置引用dll。 This may resolve your problem. 这可能会解决您的问题。

I guess it is not working as it is not being deployed within your application. 我想这不起作用,因为它没有在你的应用程序中部署。

In Visual studio, under the debug menu select 'Exceptions' then in the dialogue that appears enable 'Thrown' for 'Common language runtime exceptions' 在Visual Studio中,在调试菜单下选择“异常”,然后在出现的对话框中为“公共语言运行时异常”启用“Thrown”

Then re-run your application, Visual Studio should break now at the line in the code that is causing the Null Exception. 然后重新运行您的应用程序,Visual Studio现在应该在代码中导致Null异常的行中断。

If you reference a native library, double-check if you also reference C++ Runtime. 如果引用本机库,请仔细检查是否也引用了C ++ Runtime。 Under your project in Solution Explorer, right-click References > Add Reference... Go to Extensions and check Visual C++ Runtime Package. 在解决方案资源管理器中的项目下,右键单击“引用”>“添加引用”...转到“扩展”并检查“Visual C ++运行时包”。

Check the library file you linked, it should be a import library for DLL file. 检查您链接的库文件,它应该是DLL文件的导入库。

An import library (.lib) file contains information the linker needs to resolve external references to exported DLL functions, so the system can locate the specified DLL and exported DLL functions at run time. 导入库(.lib)文件包含链接器解析对导出的DLL函数的外部引用所需的信息,因此系统可以在运行时找到指定的DLL和导出的DLL函数。

When app start it find DLL files according to the import library, but there is no such DLL files, so C# throw a FileNotFoundException. 当app启动时根据导入库找到DLL文件,但是没有这样的DLL文件,所以C#抛出一个FileNotFoundException。 Make sure link to a static library 确保链接到静态库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM