Bug 19883 - Console (Methods) Behaviors in Mac OS X platform.
Summary: Console (Methods) Behaviors in Mac OS X platform.
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-05-19 02:39 UTC by khanbashi.k
Modified: 2014-05-19 14:34 UTC (History)
5 users (show)

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

Sample App (4.87 KB, application/zip)
2014-05-19 08:52 UTC, Udham Singh

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 19883 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 khanbashi.k 2014-05-19 02:39:08 UTC
Case# 1:
In the following statement:
Console.ForegroundColor = ConsoleColor.White;
Console.BackgroundColor = ConsoleColor.Gray;

You will not get a white text as expected. Instead you will an invisible text that match the background color.

Case# 2:
Console.CursorVisible = false;
Is not working. But it does work in Windows platform (8.1 based on my test).

Case# 3:
SoundPlayer sound = new SoundPlayer();
sound.SoundLocation = "../../Resources/Background.wav";
Does not play the music. But it does work in Windows platform (8.1 based on my test).

Comment 1 Udham Singh 2014-05-19 08:52:43 UTC
Created attachment 6836 [details]
Sample App

I have checked this issue by creating a simple console application and here is my observations:

1. When I implemented the below code, it does not change text and background color as expected in both platforms Windows as well as Mac.

Console.ForegroundColor = ConsoleColor.White;
Console.BackgroundColor = ConsoleColor.Gray;

2. After implementing "Console.CursorVisible = false;" , I observed that it is not working in-case of Mac while it is working fine on Windows.

3. When I implemented code below, it does not start music in-case of Mac while it is working fine on Windows.

SoundPlayer sound = new SoundPlayer();
sound.SoundLocation = "/Users/MM/Desktop/WavFiles/DustyF1-break23.wav";
sound.Play ();

For Windows : http://www.screencast.com/t/m2nsk8wIJNkD
For Mac : http://screencast.com/t/fvF1hCJy2kM

Environment Info:


Mac OS X 10.9.2
Xamarin Studio 4.2.5 (build 0)
Xamarin.iOS :
Xamarin.Android : 4.12.3


Windows 8.1
Xamarin Studio : 4.2.5 (build 0)
Xamarin.Android : 4.12.3
Comment 2 Mike Krüger 2014-05-19 14:07:20 UTC
Console coloring works different than you expect it to do:

using System;

public class Foo
	public static void Main (string[] args)
		Console.ForegroundColor = ConsoleColor.White;
		Console.BackgroundColor = ConsoleColor.Gray;
		System.Console.WriteLine ("Hello World");

Consoles are terminal based and not a drawing surface. Therefore coloring is only updated after you print something.

Try to do a 'System.Console.Clear ();' to clear the screen & set the bg color.
Comment 3 khanbashi.k 2014-05-19 14:20:09 UTC
In windows platform it will works but Mac it does not. I ran your code above and you can see the result in the following like:

Comment 4 Mike Krüger 2014-05-19 14:34:26 UTC
Works on mac as well...


It's just the terminal colors that aren't working as you expect. The OSX Terminal default settings are not built for the DOS ANSI colors.
You need manually tweaking the terminal colors. Terminal colors are not given in RGB ... they're just given as ANSI escape codes in general - and that's the limit.

The same may be for case #2 - I don't know if the os x terminal supports that. The Console API is more or less outdated. I wouldn't expect it to work fully on non DOS shells.

It should be safe to set some foreground colors - but that's it. I wouldn't do any high level ANSI operations with it. The API is too basic for it and you're expecting things that are not doable on console level anyways.

I would say #1 and #2 are invalid/working as expected - but I don't know much about case #3.