1

first: thank you for taking time to read about my problem even if you do not know the answer.

Well, I am using Linux(Ubuntu to be exact), and coding in C# with mono-develop a console application, but I am having problem with resizing the console width and height(or 'size' for short) and getting System.NotSupportedException.

I have searched a lot on the web, but did not find any thing to help, the majority of the other questions about resizing console in C# are in windows, but I am using Linux, so I think that the problem is because of Linux, so my question is: "Is there any way to resize console in C# in Linux?".

This is my Main function:

public static void Main(String[] args){
    Console.Clear();
    Console.Title = AppName; // This works fine, AppName is a string
    Console.WindowWidth = 20; // This is the problem
    Console.WindowHeight = 20;  // And this one
    Console.WriteLine("Width: {0}", Console.WindowWidth); // Just for debugging
    Console.WriteLine("Height: {0}", Console.WindowHeight); // Same thing
    Console.ReadKey(); //Same thing
    RestOfTheCode();

}

I also tried:

Console.SetWindowSize(20, 20);

but in this time I did not have any exception but Console Window size did not changed.

The code that I have just shown, for me means that the console window should have 20 character in Width and 20 lines as Height, but I have the default size(80, 24).

I am 99% sure that the problem is my Linux(but it can be anything else), so I will be really thankful if you helped me.

  • I flagged it as a duplicate. Why aren't you using .NET Core. It's supported there. – Palle Due Jul 01 '19 at 10:24
  • @PalleDue Are you sure this is supported in .Net Core on Linux? I dont think it is - I've never managed to get it to work, and there's more information that suggests that it's unsupported. See https://stackoverflow.com/questions/53894813/how-to-use-console-setwindowsize-on-linux-using-net-core – devklick Sep 24 '20 at 18:23
  • @Klicker: Sorry about that. It looks like you are right. – Palle Due Sep 25 '20 at 07:49

0 Answers0