Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Expected type 'System.Runtime.CompilerServices.ICastable' not found in module #8101

Closed
kant2002 opened this issue Apr 19, 2020 · 1 comment
Closed
Labels

Comments

@kant2002
Copy link
Contributor

I messing up with custom runtime, and something start falling.

EXEC : error : Expected type 'System.Runtime.CompilerServices.ICastable' not found in module 'EfiRuntime' [D:\d\kant\my\EfiTools\UefiSnake\UefiSnake.csproj]
  System.InvalidOperationException: Expected type 'System.Runtime.CompilerServices.ICastable' not found in module 'EfiRuntime'
     at Internal.IL.HelperExtensions.GetKnownType(ModuleDesc module, String namespace, String name)
     at ILCompiler.DependencyAnalysis.NodeFactory.get_ICastableInterface()
     at ILCompiler.DependencyAnalysis.EETypeNode.OutputFlags(NodeFactory factory, ObjectDataBuilder& objData)
     at ILCompiler.DependencyAnalysis.EETypeNode.GetData(NodeFactory factory, Boolean relocsOnly)
     at ILCompiler.DependencyAnalysis.ObjectNode.GetStaticDependencies(NodeFactory factory)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack()
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
     at ILCompiler.ILScanner.ILCompiler.IILScanner.Scan()
     at ILCompiler.Program.Run(String[] args)
     at ILCompiler.Program.Main(String[] args)

Seems to be it is falling in this code

if (!(this is CanonicalDefinitionEETypeNode))
{
foreach (DefType itf in _type.RuntimeInterfaces)
{
if (itf == factory.ICastableInterface)
{
flags |= (UInt16)EETypeFlags.ICastableFlag;
break;
}
}
}

because I do not implement ICastable.

If I do not have ICastable defined, maybe I do not care, and Node flag EETypeFlags.ICastableFlag should not be set at all?

@MichalStrehovsky
Copy link
Member

If I do not have ICastable defined, maybe I do not care, and Node flag EETypeFlags.ICastableFlag should not be set at all?

Yep - we can either change the compiler so that the absence of ICastable interface is not fatal, or you can just add a dummy ICastable to your corelib (it shouldn't need any methods on it, as long as no type implements the interface).

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

Successfully merging a pull request may close this issue.

3 participants