Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentException: Token 0x0600000e is not a valid FieldInfo token in the scope of module CosmosKernel1.dll. (Parameter 'metadataToken') #2859

Closed
4 tasks done
Guillermo-Santos opened this issue Dec 27, 2023 · 2 comments

Comments

@Guillermo-Santos
Copy link
Contributor

Continuation of the issue #2858.

this is throw if you change the code to a more complex one
Exception
Post the exception returned by Visual Studio
System.ArgumentException: Token 0x0600000e is not a valid FieldInfo token in the scope of module CosmosKernel1.dll. (Parameter 'metadataToken')
Visual Studio Output Logs
Post the entire output log given by Visual Studio for the build

Build started at 11:21 PM...
1>------ Build started: Project: CosmosKernel1, Configuration: Debug Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>CosmosKernel1 -> D:\source\repos\Zaphyros\CosmosKernel1\bin\Debug\net6.0\CosmosKernel1.dll
1>Executing IL2CPU on assembly
1>Kernel Base: Cosmos.System.Kernel
1>Checking target assembly: D:\source\repos\Zaphyros\CosmosKernel1\bin\Debug\net6.0\CosmosKernel1.dll
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Core_Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Core_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Debug.Kernel.Plugs.Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.System2_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Invalid plug method! Target method not found. : A0SystemIOTextReaderA2CosmosSystem_PlugsSystemConsoleImplGetOrCreateReader
1>IL2CPU : error : Exception: System.ArgumentException: Token 0x0600000e is not a valid FieldInfo token in the scope of module CosmosKernel1.dll. (Parameter 'metadataToken')
1>   at System.Reflection.RuntimeModule.ResolveField(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
1>   at Cosmos.IL2CPU.ILOpCodes.OpToken..ctor(Code aOpCode, Int32 aPos, Int32 aNextPos, Int32 aValue, Module aModule, Type[] aTypeGenericArgs, Type[] aMethodGenericArgs, _ExceptionRegionInfo aCurrentExceptionRegion) in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILOpCodes\OpToken.cs:line 46
1>   at Cosmos.IL2CPU.ILReader.ProcessMethod(MethodBase aMethod) in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILReader.cs:line 612
1>   at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug, String sourceItem) in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 584
1>   at Cosmos.IL2CPU.ILScanner.ScanQueue() in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 751
1>   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod, IEnumerable`1 plugsAssemblies) in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 270
1>   at Cosmos.IL2CPU.CompilerEngine.Execute() in D:\source\CosmosOS-Dev\CosmosOS\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 186
1>IL2CPU task took 00:00:00.3354188
1>Done building project "CosmosKernel1.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 11:21 PM and took 00.732 seconds ==========

How To Reproduce
Describe any changes done to a clean kernel for this error to occur.

            // Open database (or create if doesn't exist)
            using (var db = new LiteDatabase(@"0:\\System\\Register.db"))
            {
                // Get a collection (or create, if doesn't exist)
                var col = db.GetCollection<Customer>("customers");

                // Create your new customer instance
                var customer = new Customer
                {
                    Name = "John Doe",
                    Phones = new string[] { "8000-0000", "9000-0000" },
                    IsActive = true
                };

                // Insert new customer document (Id will be auto-incremented)
                col.Insert(customer);

                // Update a document inside a collection
                customer.Name = "Jane Doe";

                col.Update(customer);

                // Index document using document Name property
                col.EnsureIndex(x => x.Name);

                // Use LINQ to query documents (filter, sort, transform)
                var results = col.Query()
                    .Where(x => x.Name.StartsWith("J"))
                    .OrderBy(x => x.Name)
                    .Select(x => new { x.Name, NameUpper = x.Name.ToUpper() })
                    .Limit(10)
                    .ToList();

                // Let's create an index in phone numbers (using expression). It's a multikey index
                col.EnsureIndex(x => x.Phones);

                // and now we can query phones
                var r = col.FindOne(x => x.Phones.Contains("8888-5555"));
            }

Model class:

public class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string[] Phones { get; set; }
    public bool IsActive { get; set; }
}

Screenshots
If applicable, add screenshots to help explain your problem.

Context
Before posting please confirm that the following are in order

  • Both Cosmos VS Extensions are installed
  • In the NuGet Package Manager "Include prerelease" is selected
  • The Cosmos NuGet package store is selected (NOT nuget.org) in 'Manage NuGet Packages'
  • The Cosmos NuGet packages are installed

Add any other context about the problem which might be helpful.

@Guillermo-Santos
Copy link
Contributor Author

Using dev kit

@valentinbreiz
Copy link
Member

valentinbreiz commented Jan 5, 2024

Hello, linq is not supported by Cosmos yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants