Hi,

I have been playing around with the monobjc mkbundle nant task to
distribute an application which makes use of .NET web requests and I
am having trouble including the machine.config in the bundle.

Relevant part of the build file:

   <mkbundle exe="${build.dir}/${app.name}.exe"
         todir="${build.dir}"
         target="MACOSX_10_5"
         universal="true"
         
machine-config="/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/2.0/machine.config">
      <search-in basedir="${lib.dir}"/>
   </mkbundle>

Build output:
  ...
  [mkbundle] Embedding Assembly
'/Library/Frameworks/Mono.framework/Versions/2.4/lib/mono/gac/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll'
  [mkbundle] Embedding Config
'/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/2.0/machine.config'
  [mkbundle] Relocating Config
'/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/2.0/machine.config'
  [mkbundle] Source generation done in 19.93 seconds
  [mkbundle] Compiling native sources...
  ...

When running the application on a Mac without Mono the following
exception is thrown when performing a web request:

Unhandled Exception: System.NotSupportedException:
http://www.slammens.com/monobjc/test.html
   at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000]
   at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000]
   at System.Net.WebRequest.Create (System.String requestUriString) [0x00000]
   at Monobjc.Samples.HelloCocoa.HelloController.ShowMessage
(Monobjc.Id sender) [0x00000]
   at 
Monobjc.Dynamic.Proxies.Monobjc.Samples.HelloCocoa.HelloController.ShowMessage_Monobjc_Id
(IntPtr receiver, IntPtr selector, IntPtr ) [0x00000]
   at (wrapper native-to-managed)
Monobjc.Dynamic.Proxies.Monobjc.Samples.HelloCocoa.HelloController:ShowMessage_Monobjc_Id
(intptr,intptr,intptr)
   at (wrapper managed-to-native) 503C41BB:pinvoke (intptr,intptr)
   at 503C41BB.objc_msgSend (IntPtr receiver, IntPtr selector,
System.Object[] parameters) [0x00000]
   at Monobjc.Bridge.Generators.DynamicMessagingGenerator.SendMessage
(System.String message, IntPtr receiver, IntPtr selector,
System.Object[] parameters) [0x00000]
   at Monobjc.ObjectiveCRuntime.SendMessage (IManagedWrapper receiver,
System.String selector, System.Object[] parameters) [0x00000]
   at Monobjc.Cocoa.NSApplication.Run () [0x00000]
   at Monobjc.Cocoa.NSApplication.RunApplication () [0x00000]
   at Monobjc.Samples.HelloCocoa.Program.Main (System.String[] args) [0x00000]

I have modified the HelloCocoa sample from monobjc to perform a web
request when clicking the "Show Message" button. It can be downloaded
from: http://www.slammens.com/monobjc/HelloCocoaWebRequest.zip.

What am I doing wrong here?

OSX Leopard 10.5.7
Mono 2.4
Monobjc 2.0.357.0

Regards,

Steven Lammens

Reply via email to