Monomak Exception, as indicated by the type initializer for System.Net.WebRequest

I am writing a program in monomac in ftp files on a server. I used FtpWebRequest as

 FtpWebRequest request =(FtpWebRequest)WebRequest.Create("ftp://serverip/filename"); 

When I run this code in monodevelop , it works correctly. But when I release this and run outside of monodevelop , I get the error "Exception monodevelop by the initialization type for System.Net.WebRequest .

I examined this error and found that it has a problem with the libc.dylib library. If I change DYLD_FALLBACK_LIBRARY_PATH in the start of the script 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 sends files. But I have to install the mono framework on the whole system to run this application. Once I create the mac installation package, I cannot edit the launch script. I tried copying the libc.dylib file from /usr/lib to the Appbundle(App/MonoBundle/) , but there is still an error. Can someone help me?

+4
source share
1 answer

I had this problem. Are you adding monomac dll to application package?

It tries to be smart and remove unused methods and classes.

I found that it often does not include methods that, in his opinion, were not used by mistake. I'm not sure how to make it include the missing methods, however you can solve this by disabling the binding in the package settings. Unfortunately, this makes the application a lot bigger.

0
source

All Articles