Ivo Valchev
Ivo Valchev

Reputation: 265

Cosmos "Hello world" Plug generate error

I've just installed Cosmos and tried to run the test program given by default. That's the code:

using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;

namespace CosmosKernel2
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
        }

        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }
    }
}

When I try to compile it, it says:

Error   8   Plug needed. System.Void  System.Threading.Monitor.Exit(System.Object)
   at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 663
   at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 779
   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 284
   at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 239 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets    32  10  CosmosKernel2Boot

I'm using Visual Studio 2010, I have installed all requirements listed here: http://cosmos.codeplex.com/releases/view/123476

Thank you in advance!

Upvotes: 1

Views: 633

Answers (2)

Ivo Valchev
Ivo Valchev

Reputation: 265

It seems that Cosmos isn't working well with windows 8/8.1. So the only solution is to either install Windows 7 or run a virtual machine with installed Windows 7 (the latter worked for me)

Upvotes: 0

Dvir
Dvir

Reputation: 3139

"plug needed" error means that you have used some method which relies on an internal call or PInvoke, and thus Cosmos cannot compile it.

You probably use a method that has not been plugged yet or maybe missing a reference to that implementation (which makes Cosmos think it is not implemented)

Use the below guides to help you getting started:

http://www.codeproject.com/Articles/220076/Csharp-Open-Source-Managed-Operating-System-Intro

http://www.codeproject.com/Articles/29523/Cosmos-C-Open-Source-Managed-Operating-System

Update: Try using something similar to this code:

using System;
using Cosmos.Compiler.Builder;

namespace CosmosBoot1
{
    class Program
    {
        #region Cosmos Builder logic
        // Most users wont touch this. This will call the Cosmos Build tool
        [STAThread]
        static void Main(string[] args)
        {
            BuildUI.Run();
        }
        #endregion

        // Main entry point of the kernel
        public static void Init()
        {
            var xBoot = new Cosmos.Sys.Boot();
            xBoot.Execute();
            //There's supposed to be a bit of text here. Change it to Console.WriteLine("Hello world!");
        }
    }
}

Upvotes: 1

Related Questions