Bug 44707 - RemotingConfiguration.Configure() Throws RemotingException Because it Cannot Load 'machine.config'
Summary: RemotingConfiguration.Configure() Throws RemotingException Because it Cannot ...
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Base Class Libraries ()
Version: Master
Hardware: PC Mac OS
: --- normal
Target Milestone: (C9)
Assignee: Chris Hamons
Depends on:
Reported: 2016-09-23 22:25 UTC by Jimmy [MSFT]
Modified: 2016-10-28 04:41 UTC (History)
11 users (show)

Is this bug a regression?: ---
Last known good build:

repro project (348.29 KB, application/zip)
2016-09-23 22:25 UTC, Jimmy [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jimmy [MSFT] 2016-09-23 22:25:26 UTC
Created attachment 17724 [details]
repro project

#### Overview
Calling RemotingConfiguration.Configure() will cause the app to crash with

> System.Runtime.Remoting.RemotingException: Configuration file '/Users/builder/data/lanes/3508/c1e5fa01/source/xamarin-macios/builds/install/mac64/etc/mono/4.5/machine.config' could not be loaded: Could not find a part of the path "/Users/builder/data/lanes/3508/c1e5fa01/source/xamarin-macios/builds/install/mac64/etc/mono/4.5/machine.config".

Full stack trace: https://gist.github.com/jimmgarrido/766fa1c992859e430a92b6de67234873

### Steps to Reproduce
1. Run the attached repro project

### Expected Results
The app will launch.

### Actual Results
The app crashes immediately after launching.

### Version Info
=== Xamarin Studio Enterprise ===

Version 6.1 (build 5441)
Installation UUID: 94ce5106-6a72-4691-b34e-cd5857b1db66
	Mono 4.6.0 (mono-4.6.0-branch/746756c) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406000245

=== NuGet ===


=== Xamarin.Profiler ===

Version: 0.34.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: (Visual Studio Enterprise)
Android SDK: /Users/jimmygarrido/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24.0.2
SDK Build Tools Version: 24.0.2

Java SDK: /usr
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 8.0 (11246)
Build 8A218a

=== Xamarin.Mac ===

Version: (Visual Studio Enterprise)

=== Xamarin.iOS ===

Version: (Visual Studio Enterprise)
Hash: 6c3fee4
Branch: xcode8
Build date: 2016-09-09 13:01:32-0400

=== Build Information ===

Release ID: 601005441
Git revision: 68292d1ab289911c815ddc715dd7cc29a9752f9f
Build date: 2016-09-09 04:43:23-04
Xamarin addins: ed25d008672663eeb9db55f1ccecb3c24d2fd3b2
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.11.6
Darwin Jimmys-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0
    Mon Aug 29 20:21:34 PDT 2016
    root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Redth's Addins 1.0.2
Comment 1 Chris Hamons 2016-09-26 18:20:10 UTC
The root cause of this is that here:


we are not getting the right path for bundled XM applications.

I'm not sure the correct fix, but it might involve mono changes.

If you are willing to traffic in implementation specific hacks, this appears to "workaround" the issue


by using reflection to "do the right thing".
Comment 2 Chris Hamons 2016-10-04 16:52:30 UTC
I'm thinking this was caused by https://github.com/mono/mono/commit/c1a732c45276e2273ce295bac99cf3fb920b772b
Comment 3 Chris Hamons 2016-10-04 17:00:04 UTC
No, ^ was in C8 but this exception was against C8 so can't be it.
Comment 4 Chris Hamons 2016-10-04 17:03:23 UTC
Does Xamarin.Mac need to pass in a different config file (we'd need an API to do that, see my comment on  https://github.com/mono/mono/blob/master/mono/metadata/icall.c#L7178) above? 


is this a bug/behavior change in mono?
Comment 6 Rodrigo Kumpera 2016-10-05 01:12:56 UTC
As a workaround, set the MONO_CFG_DIR to a directory with a readable machine.config.

This is not a regression, AFAICT,  as this behavior exists for quite some time.
Comment 8 Chris Hamons 2016-10-10 16:48:30 UTC
Comment 11 Chris Hamons 2016-10-14 18:12:12 UTC
Please retest after 84e9975e41f48e2444d233eda64112377856276c.


Add this to additional mmp arguments:

--machine-config=""       # Yes, two double quotes w\ nothing in it

When we bumped to latest, we should have picked up mono's "real" fix.

My commit just adds a backup option in mmp to work around it \ other use cases that require the file.

Sorry for not being clear.
Comment 13 Chris Hamons 2016-10-18 15:51:01 UTC
Could you zip up your bundle and build log and attach?
Comment 15 Chris Hamons 2016-10-18 17:09:37 UTC
The combination of my fix + mono's broke it. Looking into it...
Comment 16 Chris Hamons 2016-10-18 20:40:01 UTC
Ok, we needed to bump mono again to get working after the first mono bump.

QA - Please retest against the very latest XM (3e1204278baa060c45f3a876492f91bd5582d3c5 or greater). Please note (which I forgot first time) that you will need to remoting.config's build action to BundleResource for things to work at all.
Comment 17 Mohit Kheterpal 2016-10-19 06:05:55 UTC
Thanks @Chris

I have checked this issue after setting build action of remote.config's file to Bundleresource with latest build of MonoFramework-MDK- + xamarin.mac- and observed that this issue has been fixed.

screencast : http://www.screencast.com/t/VLCgezD7

Comment 18 Naqeeb 2016-10-28 04:41:21 UTC
I have checked this issue with latest master build and observed that it is working fine after changing Build Action to BundleResource of remote.config's file . Here is the screencast for the same: http://www.screencast.com/t/uaLYLVfFC7

Environment info: https://gist.github.com/NaqeebAnsari/8f81887cca481f1a711ec07228b390da