This project is read-only.

Extension methods and methods with return types

Jun 10, 2012 at 7:15 PM

Please accept my apologies if this is a repeated question, I did a search, couldn't find anything related.

1. Does cosmos supports extension methods? throws error on extension methods!

2. I've a method signature similar to event handler, Cosmos reports 'Events with return type not yet supported!' What I wonder is does it treats this as an event handler?

public static bool Process (string cmd, params Object[] args)

 

Error 1 Events with return type not yet supported!   at Cosmos.IL2CPU.X86.Plugs.NEW_PLUGS.InvokeImplAssembler.AssembleNew(Object aAssembler, Object aMethodInfo)    in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU.X86\Plugs\NEW_PLUGS\InvokeImplAssembler.cs:line 26   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes)    in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\AppAssembler.cs:line 80   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod)    in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 360   at Cosmos.Build.MSBuild.IL2CPUTask.Execute()    in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 249

 

Any help would be appreciated.

 

Thanks,

Vasu.

Jun 10, 2012 at 7:22 PM

Please be more specific about the error. Extension methods are normal static methods with some c# compiler magic. It should just work..

Delegate types with return types are not supported.

Op 10 jun. 2012 20:15 schreef "VallarasuS" <notifications@codeplex.com> het volgende:

From: VallarasuS

Please accept my apologies if this is a repeated question, I did a search, couldn't find anything related.

1. Does cosmos supports extension methods? throws error on extension methods!

2. I've a method signature similar to event handler, Cosmos reports 'Events with return type not yet supported!' What I wonder is does it treats this as an event handler?

public static bool Process (string cmd, params Object[] args)

Error 1 Events with return type not yet supported! at Cosmos.IL2CPU.X86.Plugs.NEW_PLUGS.InvokeImplAssembler.AssembleNew(Object aAssembler, Object aMethodInfo) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU.X86\Plugs\NEW_PLUGS\InvokeImplAssembler.cs:line 26 at Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\AppAssembler.cs:line 80 at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 360 at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 249

Any help would be appreciated.

Thanks,

Vasu.

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

Jun 10, 2012 at 7:46 PM

Thanks mterwoord for your time, I'm sorry I got the reason now, I have used a Interface as source type.

 

Just sharing for others to know

        public static void ForEeach<T>(this IEnumerable<T> source, Action<T> action)
        {
            var enumerator = source.GetEnumerator();

            enumerator.MoveNext();

            do
            {
                action.Invoke(enumerator.Current);
            }
            while (enumerator.MoveNext());
        }

Here is the error message.

Error 4 '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\MSBuild\Cosmos\Cosmos.targets 32 10 NoobOSBoot

Thanks,

vasu

Jun 10, 2012 at 8:57 PM

Using interfaces is not supported...

Op 10 jun. 2012 20:46 schreef "VallarasuS" <notifications@codeplex.com> het volgende:

From: VallarasuS

Thanks mterwoord for your time, I'm sorry I got the reason now, I have used a Interface as source type.

Just sharing for others to know

        public static void ForEeach<T>(this IEnumerable<T> source, Action<T> action)
        {
            var enumerator = source.GetEnumerator();

            enumerator.MoveNext();

            do
            {
                action.Invoke(enumerator.Current);
            }
            while (enumerator.MoveNext());
        }

Here is the error message.

Error 4 '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\MSBuild\Cosmos\Cosmos.targets 32 10 NoobOSBoot

Thanks,

vasu

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

Jun 12, 2012 at 6:10 PM

Hi mterwoord!

Just making a point here! I've mentioned in my initial post that this line causes the error, But it is not.

public static bool Process (string cmd, params Object[] args) { }

After spending hours debugging I figured it out! It would be lot easier to debug if the assembler is able to figure out the line caused the error. Within the above quoted method there is a line like the following and is the source of error, the "predicate"

list.Find(predicate); 

Thanks.

Jun 12, 2012 at 6:15 PM
On 6/12/2012 1:10 PM, VallarasuS wrote:
> Hi mterwoord!
>
> Just making a point here! I've mentioned in my initial post that this
> line causes the error, But it is not.
>
> public static bool Process (string cmd,params Object[] args) { }
>
> After spending hours debugging I figured it out! It would be lot easier
> to debug if the assembler is able to figure out the line caused the
> error. Within the above quoted method there is a line like the following
> and is the source of error, the "predicate"
>
> list.Find(predicate);

The scanner generates a hyper linked log file which you can use to find
the endpoint.
Jun 12, 2012 at 6:19 PM

Oh! Really?! 

Thanks a lot! I'll take a look at it.

 

-Vasu.