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

Crossgen2 fails with TableIndexOutOfRangeException #39493

Closed
mangod9 opened this issue Jul 17, 2020 · 2 comments · Fixed by #39653
Closed

Crossgen2 fails with TableIndexOutOfRangeException #39493

mangod9 opened this issue Jul 17, 2020 · 2 comments · Fixed by #39653
Assignees
Milestone

Comments

@mangod9
Copy link
Member

mangod9 commented Jul 17, 2020

Try to compile the repro listed in #13339 using crossgen2. It fails with the following stack:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'tableIndex')
   at System.Reflection.Throw.TableIndexOutOfRange()
   at System.Reflection.Metadata.Ecma335.MetadataTokens.Handle(TableIndex tableIndex, Int32 rowNumber)
   at ILCompiler.DependencyAnalysis.ReadyToRun.CopiedMetadataBlobNode.WriteFieldRvas(NodeFactory factory, ObjectDataBuilder& builder, BlobReader& reader) in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.ReadyToRun\Compiler\DependencyAnalysis\ReadyToRun\CopiedMetadataBlobNode.cs:line 85
   at ILCompiler.DependencyAnalysis.ReadyToRun.CopiedMetadataBlobNode.GetData(NodeFactory factory, Boolean relocsOnly) in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.ReadyToRun\Compiler\DependencyAnalysis\ReadyToRun\CopiedMetadataBlobNode.cs:line 134
   at ILCompiler.DependencyAnalysis.ObjectNode.GetStaticDependencies(NodeFactory factory) in C:\git\fork\runtime\src\coreclr\src\tools\Common\Compiler\DependencyAnalysis\ObjectNode.cs:line 60
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node) in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 180
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack() in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 247
   at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.DependencyAnalysisFramework\DependencyAnalyzer.cs:line 298
   at ILCompiler.ReadyToRunCodegenCompilation.RewriteComponentFile(String inputFile, String outputFile, String ownerExecutableName) in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.ReadyToRun\Compiler\ReadyToRunCodegenCompilation.cs:line 355
   at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in C:\git\fork\runtime\src\coreclr\src\tools\aot\ILCompiler.ReadyToRun\Compiler\ReadyToRunCodegenCompilation.cs:line 319
   at ILCompiler.Program.Run() in C:\git\fork\runtime\src\coreclr\src\tools\aot\crossgen2\Program.cs:line 545
   at ILCompiler.Program.InnerMain(CommandLineOptions buildOptions) in C:\git\fork\runtime\src\coreclr\src\tools\aot\crossgen2\Program.cs:line 655
@mangod9 mangod9 added this to the 5.0.0 milestone Jul 17, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Jul 17, 2020
@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Jul 17, 2020
@MichalStrehovsky
Copy link
Member

I see RewriteComponentFile in the stack - this is a WPF application and therefore Managed C++. The input is probably sneaking past the checks @trylek added in #38113.

@mangod9
Copy link
Member Author

mangod9 commented Jul 17, 2020

Thanks @MichalStrehovsky for taking a look. Will assign to @trylek so we can handle this case.

trylek added a commit to trylek/runtime that referenced this issue Jul 20, 2020
Fixes: dotnet#39493

Turns out the compilation failure here wasn't caused by Managed C++,
it was due to a simple bug in the field RVA copy loop - reading
compressed 16-bit field indices as signed, not unsigned, from the
FieldRVA ECMA metadata table.

Thanks

Tomas
trylek added a commit that referenced this issue Jul 21, 2020
Fixes: #39493

Turns out the compilation failure here wasn't caused by Managed C++,
it was due to a simple bug in the field RVA copy loop - reading
compressed 16-bit field indices as signed, not unsigned, from the
FieldRVA ECMA metadata table.

Thanks

Tomas
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this issue Aug 10, 2020
Fixes: dotnet#39493

Turns out the compilation failure here wasn't caused by Managed C++,
it was due to a simple bug in the field RVA copy loop - reading
compressed 16-bit field indices as signed, not unsigned, from the
FieldRVA ECMA metadata table.

Thanks

Tomas
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants