Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Array.Sort: Error ocurred while invoking IL2CPU

Open ERamaM opened this issue 7 years ago • 9 comments

Using Array.Sort gives IL2CPU error

Excerpt of malfunctioning code:

            int[] array = new int[3];
            array[0] = 0;
            array[1] = 4;
            array[2] = -1;
            Array.Sort(array);
            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine(array[i]); 
            }

ERamaM avatar Feb 28 '17 11:02 ERamaM

You used Linq. Try not to use Linq (by creating your own Array.Sort method).

ghost avatar Feb 28 '17 20:02 ghost

Did this resolve the error? Can this issue be closed?

quajak avatar Aug 08 '18 09:08 quajak

Can this be reproduced?

MishaTy avatar Feb 07 '22 19:02 MishaTy

I have similar problem with linq throwing exeption during build Exception: System.Exception: <project folder>\IL2CPU for example with this code: dictionary.Values.OrderBy(w => w.ZIndex) It should be easily reproduced - its probably caused by most of its functions like those I guess. Is linq intentionaly unsupported or its just not supported atm?

astromediaonly avatar Feb 19 '22 15:02 astromediaonly

It's just unsupported currently due to missing features in IL2CPU

MishaTy avatar Feb 19 '22 15:02 MishaTy

Still not fixed:

1>Native code encountered, plug required.
1>  DO NOT REPORT THIS AS A BUG.
1>  Please see http://www.gocosmos.org/docs/plugs/missing/
1>  Need plug for: System.Void  System.Reflection.MetadataImport._GetNamespace(System.IntPtr, System.Int32, System.Void**)(Plug Signature: System_Void__System_Reflection_MetadataImport__GetNamespace_System_IntPtr__System_Int32__System_Void___ ).
1>  Static: True
1>  Assembly: System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
1>  Called from:
1>System.Reflection.MetadataImport::System.MdUtf8String GetNamespace(Int32)
1>System.RuntimeType+RuntimeTypeCache::System.String GetNameSpace()
1>System.RuntimeType::System.String get_Namespace()
1>System.Type::System.String get_Namespace()
1>
1>
1>   at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug, String sourceItem) in C:\Source\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 625

MishaTy avatar Apr 06 '22 23:04 MishaTy

This is for Array.Sort or the Dictionary.OrderBy case?

quajak avatar Apr 07 '22 18:04 quajak

It is for Array.Sort

MishaTy avatar Apr 07 '22 19:04 MishaTy

Ok, we should go ahead an just add an NIE plug for Type.get_Namespace and see if that is enough.

quajak avatar Apr 08 '22 14:04 quajak