Dummy.Type

Nov 7, 2009 at 3:20 AM

Hello.

I left my compiler for a couple of weeks. It was working ok.

Today I wanted to continue on it but it doesn't work anymore.

When it loads assemblies to discover type methods the return types are DummyType. I see DummyType everywhere.

What could be happened?

Yesterday I installed VS2010 beta (but I'm still working with it in VS2008). Can that be the cause?

Thanks.

 

Coordinator
Nov 7, 2009 at 3:27 AM

I'm afraid that it is pretty hard to tell what is going on from your description alone. Have you updated the CCI sources? If so, try going back to the sources you've had a couple of weeks ago. If that helps, we can try and track down the CCI change that caused the problem. If not, it could well be the installation of VS2010 beta and we'll have to try and reproduce that situation in order to figure things out.

All I can say, is that no-one else has reported a similar experience, so investigation is needed.

Nov 7, 2009 at 4:56 AM
Edited Nov 9, 2009 at 5:36 PM

I didn't update any CCI sources recently.

I downloaded more recent sources (to get the copy of the CCI/AST helloworld examples) but they are a different copy from the one I use with my compiler.

I excluded any "v4.0" subdirectory from my compiler's search paths and finally deinstalled VS2010 and restarted my computer but it had no effect.

This is a piece of the Methods list of System.Console from mscorlib 2.0.0 as copied from the Watch window of VisualStudio:

+        [0]    {Microsoft.Cci.DummyType System.Console.InternalSyncObject.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [1]    {Microsoft.Cci.DummyType System.Console.ConsoleInputHandle.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [2]    {Microsoft.Cci.DummyType System.Console.ConsoleOutputHandle.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [3]    {System.IO.TextWriter System.Console.Error.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [4]    {System.IO.TextReader System.Console.In.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [5]    {System.IO.TextWriter System.Console.Out.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [6]    {Microsoft.Cci.DummyType System.Console.InitializeStdOutError(Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [7]    {System.IO.Stream System.Console.GetStandardFile(Microsoft.Cci.DummyType, System.IO.FileAccess, Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [8]    {System.Text.Encoding System.Console.InputEncoding.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [9]    {Microsoft.Cci.DummyType System.Console.InputEncoding.set(System.Text.Encoding)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [10]    {System.Text.Encoding System.Console.OutputEncoding.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [11]    {Microsoft.Cci.DummyType System.Console.OutputEncoding.set(System.Text.Encoding)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [12]    {Microsoft.Cci.DummyType System.Console.Beep()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [13]    {Microsoft.Cci.DummyType System.Console.Beep(Microsoft.Cci.DummyType, Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [14]    {Microsoft.Cci.DummyType System.Console.Clear()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [15]    {Microsoft.Win32.Win32Native.Color System.Console.ConsoleColorToColorAttribute(System.ConsoleColor, Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [16]    {System.ConsoleColor System.Console.ColorAttributeToConsoleColor(Microsoft.Win32.Win32Native.Color)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [17]    {System.ConsoleColor System.Console.BackgroundColor.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [18]    {Microsoft.Cci.DummyType System.Console.BackgroundColor.set(System.ConsoleColor)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [19]    {System.ConsoleColor System.Console.ForegroundColor.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [20]    {Microsoft.Cci.DummyType System.Console.ForegroundColor.set(System.ConsoleColor)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [21]    {Microsoft.Cci.DummyType System.Console.ResetColor()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [22]    {Microsoft.Cci.DummyType System.Console.MoveBufferArea(Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [23]    {Microsoft.Cci.DummyType System.Console.MoveBufferArea(Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, Microsoft.Cci.DummyType, System.ConsoleColor, System.ConsoleColor)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [24]    {Microsoft.Win32.Win32Native.CONSOLE_SCREEN_BUFFER_INFO System.Console.GetBufferInfo()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [25]    {Microsoft.Win32.Win32Native.CONSOLE_SCREEN_BUFFER_INFO System.Console.GetBufferInfo(Microsoft.Cci.DummyType, Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [26]    {Microsoft.Cci.DummyType System.Console.BufferHeight.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [27]    {Microsoft.Cci.DummyType System.Console.BufferHeight.set(Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [28]    {Microsoft.Cci.DummyType System.Console.BufferWidth.get()}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}
+        [29]    {Microsoft.Cci.DummyType System.Console.BufferWidth.set(Microsoft.Cci.DummyType)}    Microsoft.Cci.IMethodDefinition {Microsoft.Cci.MetadataReader.ObjectModelImplementation.NonGenericMethod}

 

 

I see that

System.IO.TextWriter System.Console.Out.get() // <---- I have a real return type here

but

Microsoft.Cci.DummyType System.Console.Beep(Microsoft.Cci.DummyType, Microsoft.Cci.DummyType) // <---- all is replaced with DummyType here

It should be

void System.Console.Beep(int, int)

so "primitive" types are being replaced with DummyType.

It didn't use to be like that,

My compiler has several test programs that call Console.WriteLine(string) or Console.WriteLine(int) and they used to compile.

Maybe it's my fault but I cannot imagine what could cause that.

Coordinator
Nov 7, 2009 at 6:52 AM

Well, something must have changed. :-)

It seems that, somehow, IMetadataHost.IPlatformTypes now returns a dummy instance. You might want to put break points at all of the properties that return a value of IPlatformType, starting with the metadata host, and see when the property gets evaluated.

One thing to watch out for is the debugger's (generally nice) habit of evaluating properties. This can cause debug sessions to behave differently from normal program runs and you can spend many hours scratching your head until you realize that the debugger is working against you and not for you.

Nov 9, 2009 at 2:22 AM
Edited Nov 9, 2009 at 3:16 AM

Ok. The problem was that I wasn't loading the CoreAssembly of an HostEnvironment before using it to gather the informations to use to bind the method calls of my program.

I don't understand why it's not loaded automatically and why it was being loaded before (maybe it has to do with some UI refactoring that may have caused code to run in a different order - it's some kind of interactive environment).

Anyway if I evaluate the CoreAssembly property before using the HostEnvironement, everything works as usual.

Probably the debugger wasn't working with me, as you said. I had that kind of problems when I was trying to follow the source code of the Small Basic compiler.

In conclusion, this is not a bug or a problem in CCI. Some other people could have a similar problem, tho.

Thanks.