Bug 20828 - MONO_ENV_OPTIONS is set which causes debugging to not work when a CLI process is spawned by a Xam.Mac app.
Summary: MONO_ENV_OPTIONS is set which causes debugging to not work when a CLI process...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 1.8.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Aaron Bockover [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2014-06-23 21:41 UTC by Jon Goldberger [MSFT]
Modified: 2014-06-24 17:22 UTC (History)
1 user (show)

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

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:
Status:
RESOLVED FIXED

Comment 1 Jon Goldberger [MSFT] 2014-06-23 21:48:55 UTC
Steps to reproduce

1. Open the test project.
2. Set the MacApp as the startup project and run. 

Expected result: the CLI app will run and "Hello world" will be displayed.

Actual result: CLI app does not run, and the message 
debugger-agent: Unable to connect to 127.0.0.1:52942
is displayed. 

If debug information is set to "None" in the MacApp Project Options->Build->Compiler settings page, then the CLI process will run and "Hello World" will be displayed in the console, but of course then debugging is not possible.

The workaround is to set the  MONO_ENV_OPTIONS environment variable to null in main() method of the MacApp project with:

System.Environment.SetEnvironmentVariable ("MONO_ENV_OPTIONS", null);

This resolves the above issue.