Monomac System.Net.WebRequest 的类型初始值设定项引发的异常
我正在用 monomac
编写一个程序,将文件 ftp 到服务器。我使用 FtpWebRequest
作为
FtpWebRequest request =(FtpWebRequest)WebRequest.Create("ftp://serverip/filename");
当我在 monodevelop
中运行此代码时,它运行正常。但是当我释放它并在 monodevelop
之外运行时,我收到错误“An Exception as returned by the typeinitialize for System.Net.WebRequest
。
我研究了这个错误并发现 则库 libc.dylib 有问题。
如果我将 app(AppBundle/MacOs/AppName edit with TextEdit)
的启动脚本中的 DYLD_FALLBACK_LIBRARY_PATH 更改为导出, DYLD_FALLBACK_LIBRARY_PATH="$MONO_FRAMEWORK_PATH/lib:$DYLD_FALLBACK_LIBRARY_PATH:/usr/lib"
(添加/usr/lib) 然后它正在发送文件。但我必须在所有系统中安装单框架才能运行这个应用程序。一旦我创建了 mac 安装程序包,我就无法编辑启动脚本。我尝试将 libc.dylib
文件从 /usr/lib
复制到 Appbundle(App/MonoBundle/)
但错误仍然存在。 谁能帮助我吗?
I'm writing a program in monomac
to ftp files to a server. I used the FtpWebRequest
as
FtpWebRequest request =(FtpWebRequest)WebRequest.Create("ftp://serverip/filename");
When I'm running this code in monodevelop
its running properly. But when I release this and runs outside monodevelop
I get the error "An Exception as thrown by the type initialize for System.Net.WebRequest
.
I researched for this error and found it has problem with the library libc.dylib. If I change the DYLD_FALLBACK_LIBRARY_PATH in launch script of the app(AppBundle/MacOs/AppName edit with TextEdit)
as
export DYLD_FALLBACK_LIBRARY_PATH="$MONO_FRAMEWORK_PATH/lib:$DYLD_FALLBACK_LIBRARY_PATH:/usr/lib"
(added /usr/lib)
then it is sending the files. But I have to install mono framework in all system to run this app. Once i create a mac installer package i cannot edit the the launch script. I tried copying libc.dylib
file from /usr/lib
to Appbundle(App/MonoBundle/)
but still the error exists.
Can anyone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有这个问题。您是否将 monomac dll 添加到应用程序包中?
它试图变得聪明并删除未使用的方法和类。
我发现它通常不会包含它认为没有被错误使用的方法。
我不确定如何强制它包含缺少的方法,但是您可以通过关闭包设置中的链接来解决此问题。不幸的是,这使得应用程序变得更大。
I had this issue. Are you adding monomac dll's to the app bundle?
It tries to be clever and remove unused methods and classes.
I found that it would often not include methods it thought were not being used by mistake.
I'm not sure how to force it to include the missing methods, however you can solve this by turn off linking in the package settings. Unfortunately this makes the app much bigger.