Stack Empty...bahumbug

Sep 4, 2011 at 1:18 AM

Okeydokey, so I finally got all the graphicsdriver and stuff working, but when I use the following code:

using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;
using GUICOS.Graphics;
namespace GUICOS
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {

        }
        public static Monitor s = new Monitor();
        protected override void Run()
        {
            Pixel pix = new Pixel();
            pix.A = 0;
            pix.B = 0;
            pix.G = 0;
            pix.R = 1;
            s.Taskbar.SetPixel(123, 12, pix);
            Console.WriteLine("Hi");
            Console.ReadLine();
        }
    }
}
In the Kernel.cs file, I get the following error:
Error	Stack empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Stack`1.Pop()
   at Cosmos.Compiler.Assembler.StackContents.Pop() in c:\Users\me\Documents\LATEST COSMOS\source2\Compiler\Cosmos.Compiler.Assembler\StackContents.cs:line 74
   at Cosmos.IL2CPU.X86.IL.Call.DoExecute(Assembler Assembler, MethodInfo aCurrentMethod, MethodBase aTargetMethod, ILOpCode aCurrent, String currentLabel, String nextLabel) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Call.cs:line 139
   at Cosmos.IL2CPU.X86.IL.Call.DoExecute(Assembler Assembler, MethodInfo aCurrentMethod, MethodBase aTargetMethod, ILOpCode aCurrent, String currentLabel) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Call.cs:line 77
   at Cosmos.IL2CPU.X86.IL.Call.Execute(MethodInfo aMethod, ILOpCode aOpCode) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Call.cs:line 72
   at Cosmos.IL2CPU.X86.IL.Newobj.Assemble(Assembler aAssembler, MethodInfo aMethod, OpMethod xMethod, String currentLabel, Type objectType, MethodBase constructor) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Newobj.cs:line 89
   at Cosmos.IL2CPU.X86.IL.Newobj.Execute(MethodInfo aMethod, ILOpCode aOpCode) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Newobj.cs:line 21
   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU\AppAssembler.cs:line 153
   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Users\me\Documents\LATEST COSMOS\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 419
   at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Users\me\Documents\LATEST COSMOS\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 245

help ?

Developer
Sep 4, 2011 at 2:12 AM

Firstly, there's a reason I didn't just tell you to use the monitor class in Orvid.Graphics :P  Secondly, this is due to an issue in the way the newobj IL instruction is compiled, and i'm not sure when it will be fixed.

Coordinator
Sep 4, 2011 at 2:40 AM
> Firstly, there's a reason I didn't just tell you to use the monitor
> class in Orvid.Graphics :P Secondly, this is due to an issue in the way
> the newobj IL instruction is compiled, and i'm not sure when it will be
> fixed.

After we get the asm debugger finalized. :)
Developer
Sep 4, 2011 at 2:46 AM
Edited Sep 4, 2011 at 2:46 AM

Also, MAScodes, as a note, the bit of code you posted wouldn't actually draw anything, as an alpha level of 0 is fully transparent, and 255 is fully opaque. Also, a red value of 1 wouldn't be noticeable, if you wanted it to be noticeable, use new Pixel(0,255,0,255), as that will get you a pure red pixel.

Coordinator
Sep 4, 2011 at 6:48 AM
Are you able to reproduce using a simple standalone piece of code? newobj has been stable for a while..


On Sun, Sep 4, 2011 at 4:46 AM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

also, as a note, the bit of code you posted wouldn't actually draw anything, as an alpha level of 0 is fully transparent, and 255 is fully opaque. Also, a red value of 1 wouldn't be noticeable, if you wanted it to be noticeable, use new Pixel(0,255,0,255), as that will get you a pure red pixel.

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


Coordinator
Sep 4, 2011 at 10:42 AM

If you not use the changes of changeset 83019 then this error happens for struct's. So please try it with this changes. If error not fixed please tell us what Pixel and Monitor is, because of other namespace name.

Developer
Sep 4, 2011 at 1:50 PM

@mterwoord, it was originally caused by using a constructor for a struct in the initializer of a static field.
@Trivalik, I'll make sure to install the newest update then, as I've not updated my install in a while now.

Coordinator
Sep 4, 2011 at 4:52 PM
> If you not use the changes of changeset 83019
> <http://cosmos.codeplex.com/SourceControl/changeset/changes/83019> then
> this error happens for struct's. So please try it with this changes. If
> error not fixed please tell us what Pixel and Monitor is, because of
> other namespace name.

Structs and fields have an issue because of ldfld. I spent a lot of time
tracing and never found it, and thats why we started on the new ASM
debugger.
Coordinator
Sep 4, 2011 at 9:21 PM

I have found one in newobj, that fix the empty stack and also a copy of bigger than int, please try last changeset 83238.

Sep 5, 2011 at 12:09 AM

thanks, Trivalik!