Referencing Namespaces

Mar 14, 2012 at 11:42 PM

Hello.

I added the code for an open source C# calculator to my OS to be called like this:

ConsoleCalculator.Program.Main();

However, I get this error:

Error 1 'this' type cannot be an interface itself.   at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle)   at System.RuntimeType.GetInterfaceMap(Type ifaceType)   at Cosmos.IL2CPU.ILScanner.ScanType(Type aType) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 931   at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 959   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 316   at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 249 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets 32 10  CSCos2Boot

Any ideas of what's happening?

Developer
Mar 15, 2012 at 1:54 AM

Is calculator static?

On Mar 14, 2012 4:42 PM, "WMH123" <notifications@codeplex.com> wrote:

From: WMH123

Hello.

I added the code for an open source C# calculator to my OS to be called like this:

ConsoleCalculator.Program.Main();

However, I get this error:

Error 1 'this' type cannot be an interface itself. at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle) at System.RuntimeType.GetInterfaceMap(Type ifaceType) at Cosmos.IL2CPU.ILScanner.ScanType(Type aType) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 931 at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 959 at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 316 at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 249 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets 32 10 CSCos2Boot

Any ideas of what's happening?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Mar 15, 2012 at 2:10 AM

Yes.

Here's the code for ConsoleCalculator.Program.Main();

public static void Main() {
			Calculator calc = new Calculator();
            CSCos2.Kernel.NameVerDisp();
			Console.WriteLine("CSC/os Calculator [Version 1.0.0.1]");
			Console.WriteLine("");
			do {
				try {
                    input:
					Console.Write(">");
					string input = Console.ReadLine();
                    input = input.ToLower();
					if(string.IsNullOrEmpty(input))
						continue;
					if(input == "help" || input == "?") {
						Console.WriteLine("Available functions: ");
						foreach(var fun in calc.Functions)
							Console.Write("{0,8}", fun);
                        Console.Write("  exit");
						Console.WriteLine();
						continue;
					}
                    if (input == "cls")
                    {
                        Console.Clear();
                        Console.WriteLine("");
                        goto input;
                    }
                    if (input == "exit")
                    {
                        return;
                    }
					bool result = calc.Execute(input);
					if(result)
						Console.WriteLine("ans = {0}", calc.Answer);
					else
						Console.WriteLine("OK.");
				}
				catch(CalculatorException ex) {
					Console.WriteLine(ex.Message);
				}
				Console.WriteLine();
			} while(true);
		}