Bug 7968 - Environment.UserInteractive returns wrong value on Linux
Summary: Environment.UserInteractive returns wrong value on Linux
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-10-24 10:56 UTC by Eric Lawrence
Modified: 2013-07-08 10:40 UTC (History)
2 users (show)

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

Console/Service app that uses Environment.UserInteractive (1.87 KB, text/plain)
2013-07-08 10:40 UTC, Fritz

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 for Bug 7968 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Eric Lawrence 2012-10-24 10:56:55 UTC
Environment.UserInteractive always returns false on Linux. This causes lots of problems in porting Windows code.


		/// <summary>
		/// Gets a flag indicating whether the process is in interactive mode
		/// </summary>
		[MonoTODO ("Currently always returns false, regardless of interactive state")]
		public static bool UserInteractive {
			get {
				return false;

If this is desirable for any reason, the Mono documentation should at least be updated.
Comment 1 Fritz 2013-07-08 10:40:37 UTC
Created attachment 4283 [details]
Console/Service app that uses Environment.UserInteractive
Comment 2 Fritz 2013-07-08 10:40:50 UTC
What is the status or comments on this item. I have a console app that needs to be used as windows service and an option to be run in the console. 

To do this, an option is to check "Environment.UserInteractive" if it is true most of the time this means it is run in the console or terminal. If it is false. it is running as a service. With mono it always returns false which, results in the attached program to run incorrectly. This works fine with MS .NET.

I have attached a simple service that can be used as an example.