3 Replies - 3843 Views - Last Post: 05 August 2010 - 07:17 PM Rate Topic: -----

#1 Cuzzie  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 72
  • View blog
  • Posts: 341
  • Joined: 16-July 10

MonoDevelop problem

Posted 05 August 2010 - 12:06 PM

Hi there everyone. Does anyone here uses MonoDevelop to write C# codes on Linux? I tried fooling around with it today, and it works nicely until I encountered a very weird problem...


using System;

namespace Application
{


	public class HelloWorld2
	{

		static void Main(){
			Console.WriteLine("Enter a string: ");
			string str = Console.ReadLine();
			Console.WriteLine("{0} is entered!", str);
		}
	}
}



Nothing's wrong with this code, right? But when I ran the code, the Console.ReadLine() part is skipped. This output is produced.


Enter a string: 
 is entered!




I wasn't prompted to enter the string at all. Does anyone know what's going on? Is it MonoDevelop's problem? And I tried running the .cs file in terminal, mono HelloWorld.cs , and this came out.


Cannot open assembly 'HelloWorld2.cs': File does not contain a valid CIL image.




Thanks in advance. :)

Is This A Good Question/Topic? 0
  • +

Replies To: MonoDevelop problem

#2 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4463
  • View blog
  • Posts: 7,777
  • Joined: 08-June 10

Re: MonoDevelop problem

Posted 05 August 2010 - 12:25 PM

This article may answer your first question.

As to the second, I believe the "mono" program runs compiled assemblies. .cs files aren't compiled yet, they're just text files with source code.
Was This Post Helpful? 1
  • +
  • -

#3 Cuzzie  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 72
  • View blog
  • Posts: 341
  • Joined: 16-July 10

Re: MonoDevelop problem

Posted 05 August 2010 - 12:27 PM

Thanks a lot!! :)
Was This Post Helpful? 0
  • +
  • -

#4 demausdauth  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 177
  • View blog
  • Posts: 641
  • Joined: 03-February 10

Re: MonoDevelop problem

Posted 05 August 2010 - 07:17 PM

If you look at the code that you posted -- line 11 is actually a WriteLine() rather than the ReadLine() that I think you meant. Could be a lot of the problem??
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1