This project is read-only.

Interface not found error

Sep 8, 2011 at 7:26 AM

I am fairly new to cosmos, so please bare with me.

I am creating an OS in f# which implements a simple AI scripting language that is interpreted and can be interacted with by the users. I have had the language working on windows with normal f#, but when I port the code over to cosmos and try to build I get an error like this:

Error 1 Interface not found.   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 759   at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 781   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 AIOSBoot

This seems to me like there is somewhere in my code that uses interfaces. I know that my code references System.Text.RegularExpressions significantly, so this could be the source of the problem. Although, I do also reference System.Collections.Generic.Dictionary too. Are these known problem libraries, or do they work and I am using an interface in some hidden fsharpy way that I have not figured out yet?

Thanks in advance.

Keith Simmons

Sep 8, 2011 at 8:26 AM
In general, interfaces are NOT supported with the current compiler..


On Thu, Sep 8, 2011 at 8:26 AM, Oragamster <notifications@codeplex.com> wrote:

From: Oragamster

I am fairly new to cosmos, so please bare with me.

I am creating an OS in f# which implements a simple AI scripting language that is interpreted and can be interacted with by the users. I have had the language working on windows with normal f#, but when I port the code over to cosmos and try to build I get an error like this:

Error 1 Interface not found. 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 759 at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 781 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 AIOSBoot

This seems to me like there is somewhere in my code that uses interfaces. I know that my code references System.Text.RegularExpressions significantly, so this could be the source of the problem. Although, I do also reference System.Collections.Generic.Dictionary too. Are these known problem libraries, or do they work and I am using an interface in some hidden fsharpy way that I have not figured out yet?

Thanks in advance.

Keith Simmons

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


Sep 8, 2011 at 2:10 PM

It's regex that's causing your issues. Regex works by dynamically creating the methods at runtime, and with Cosmos, that doesn't work. Try a pre-compiled version instead. (I know there's a tool in SharpDevelop to do this, not sure about much past that.)

Sep 8, 2011 at 3:08 PM

Ok thanks. Are we sure that Dictionaries and such are not a problem as well? Because I am pretty sure that they use extensive use of interfaces under the cover...

Sep 8, 2011 at 3:39 PM

Thanks for the fast response btw

Sep 8, 2011 at 4:18 PM
Like I said interfaces is in general not supported. there are some cases where it works, but as a thumb-rule, assume it doesn't.

Dictionary uses interfaces for the equality comparer..


On Thu, Sep 8, 2011 at 4:39 PM, Oragamster <notifications@codeplex.com> wrote:

From: Oragamster

Thanks for the fast response btw

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


Sep 9, 2011 at 2:51 AM

What is going to be required for interfaces to work? Do we have a development plan that is in place to work on this, or is it too far in the horizon?

Sep 9, 2011 at 1:43 PM
Edited Sep 9, 2011 at 1:47 PM

Interfaces in .net are typically resolved at runtime, meaning we'd have to keep track of every method's signature at run-time. Perhaps a simple way of verification would be to generate both an implicit signature (to be checked first), and an explicit signature, then check those against the interfaces that are supposedly implemented.

If I remember correctly, interface support is currently specced for after the next compiler rework.

Sep 9, 2011 at 1:47 PM
blah: not really understand your proposed solution.

interfaces use callvirt as well, which basically requires us to resolve the actual method implementation at runtime, just like what we have to do with the virtual/abstract methods on classes. Problem is that our scanner is not able to detect all interfaces correctly.


On Fri, Sep 9, 2011 at 2:43 PM, blah38621 <notifications@codeplex.com> wrote:

From: blah38621

Interfaces in .net are typically resolved at runtime, meaning we'd have to keep track of all of the info on the method at compile time. Perhaps a simple way of verification would be to generate both an implicit signature (to be checked first), and an explicit signature, then check those against the interfaces that are supposedly implemented.

If I remember correctly, interface support is currently specced for after the next compiler rework.

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