I took option 1, just place the file where mono expects it. Not that nice but I was time constrained and was hoping that the bug would be fixed soon.

Porting System.Web code to Mac is something I will look at soon, this is the best sollution.

Regards,

Steven

On 21 Jul 2009, at 15:59, "Franky De Meyer" <[email protected]> wrote:

Steven, Have you found a work around for this?

I bumped into the same thing, and this "machine.config" problem is the last obstacle (I hope) to finally making my app native, no longer needing mono to
be installed.
I see that the bug has not yet been fixed in the latest Mono release, so I'm
looking at following alternatives:

1.
Copying the machine.config file at program startup to a location where mono
expects it (and maybe removing it at exit).
I only know of
"/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/2.0/ machine.co nfig", but that seems like a bad idea. Maybe there are other locations that
Mono is searching.

2.
Going back to Mono 2.2, which I don't really want to do either.

3.
Port all my .NET web request code to corresponding Mac code, so that I can
do away with System.Web alltogether.
The Mac equivalent calls are probably in WebKit, I haven't looked into that
yet.


I'm planning on going for option 3, which seems the least fragile solution.
Any other suggestions?
Thanks!

Franky




-----Original Message-----
From: Steven Lammens [mailto:[email protected]]
Sent: woensdag 27 mei 2009 9:31
To: [email protected]
Subject: [[email protected]] mkbundle and machine.config problem

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.co
nfig'
 [mkbundle] Relocating Config
'/Library/Frameworks/Mono.framework/Versions/Current/etc/mono/2.0/ machine.co
nfig'
 [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.ShowMessa


ge_Monobjc_Id
(IntPtr receiver, IntPtr selector, IntPtr ) [0x00000]
  at (wrapper native-to-managed)
Monobjc.Dynamic.Proxies.Monobjc.Samples.HelloCocoa.HelloController:ShowMessa


ge_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