开发者

Monomac An Exception as thown by the type initializer for System.Net.WebRequest

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜