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

ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer threw an exception of type 'System.IndexOutOfRangeException' #87647

Closed
radical opened this issue Jun 15, 2023 · 6 comments · Fixed by #87659
Assignees
Labels
arch-wasm WebAssembly architecture area-Tools-ILLink .NET linker development as well as trimming analyzers Known Build Error Use this to report build issues in the .NET Helix tab test-failure
Milestone

Comments

@radical
Copy link
Member

radical commented Jun 15, 2023

Using fe866e6 I can't build dotnet new wasmconsole projects:

  Microsoft (R) Visual C# Compiler version 4.7.0-3.23315.1 (7a7690ea) (TaskId:107)
  Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:107)
CSC : error AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'. [/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt/Debug_w1hn3hlk.m21/Debug_w1hn3hlk.m21.csproj]
  Exception occurred with following context: (TaskId:107)
  Compilation: Debug_w1hn3hlk.m21 (TaskId:107)
  ISymbol: <Main>$ (Method) (TaskId:107)
  System.IndexOutOfRangeException: Index was outside the bounds of the array. (TaskId:107)
  at ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer.<>c.<Initialize>b__7_3(SymbolAnalysisContext context) (TaskId:107)
  at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken) (TaskId:107)
  ----- (TaskId:107)
  Suppress the following diagnostics to disable this analyzer: IL2026, IL2032, IL2041, IL2043, IL2055, IL2057, IL2058, IL2059, IL2060, IL2062, IL2063, IL2064, IL2065, IL2066, IL2067, IL2068, IL2069, IL2070, IL2071, IL2072, IL2073, IL2074, IL2075, IL2076, IL2077, IL2078, IL2079, IL2080, IL2081, IL2082, IL2083, IL2084, IL2085, IL2086, IL2087, IL2088, IL2089, IL2090, IL2091, IL2092, IL2093, IL2094, IL2095, IL2096, IL2097, IL2098, IL2099, IL2103, IL2106, IL2110, IL2111 (TaskId:107)
  CompilerServer: server - server processed compilation - 9624bd43-5dab-4d62-9e51-fbed45800538 (TaskId:107)
Done executing task "Csc" -- FAILED. (TaskId:107)

  • The failing build uses microsoft.net.illink.tasks/8.0.0-preview.6.23314.14

  • The last passing build on CI was for 3c2ebd5

    • which used sdk 8.0.100-preview.6.23314.19 to build WBT
  • I tested with fe866e6

    • which used sdk 8.0.100-preview.6.23315.7 to build WBT
  • The changes in sdk (6ce52a339247f9a848ff97fa418070b65de92b4d..1a17b18064c9bbf7dcb2155a03f2c92fe657fba1) include:

+    <Dependency Name="Microsoft.NET.ILLink.Tasks" Version="8.0.0-preview.6.23314.14">
       <Uri>https://github.com/dotnet/runtime</Uri>
-      <Sha>54dab738de58291ebefc8ff0569a799efaff5d82</Sha>
+      <Sha>0a0fa137097595ad8ec0e2aa9ecffb524cd5df95</Sha>
     </Dependency>

And that includes #87156 Fix trim analyzer warning for inferred type arguments #87156.

cc @sbomer

I will open a PR to use the older sdk for now, for Wasm.Build.Tests . And to trigger wasm jobs on linker changes.

Known Issue Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "",
  "ErrorPattern": "Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.IndexOutOfRangeException",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎
Result validation: ⚠️ Validation could not be done without an Azure DevOps build URL on the issue. Please add it to the "Build: 🔎" line.

Report

Build Definition Test Pull Request
309611 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution
309003 dotnet/runtime Workloads-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87285
309051 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #85796
309441 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87661
309359 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87659
309335 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87660
309319 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87260
309057 dotnet/runtime Workloads-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution
309019 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #86722
308955 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87634
308892 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution
308854 dotnet/runtime Workloads-NoWebcil-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87260
308843 dotnet/runtime Workloads-Wasm.Build.Tests.WasmTemplateTests.WorkItemExecution #87629

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
3 13 13
@radical radical added arch-wasm WebAssembly architecture blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' test-failure area-Tools-ILLink .NET linker development as well as trimming analyzers labels Jun 15, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 15, 2023
@ghost
Copy link

ghost commented Jun 15, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Using fe866e6 I can't build dotnet new wasmconsole projects:

                     Microsoft (R) Visual C# Compiler version 4.7.0-3.23315.1 (7a7690ea) (TaskId:107)
                     Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:107)
19:39:42.736   1:7>CSC : error AD0001: Analyzer 'ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'. [/workspaces/runtime/artifacts/bin/Wasm.Build.Tests/Release/net8.0/browser-wasm/wbt/Debug_w1hn3hlk.m21/Debug_w1hn3hlk.m21.csproj]
                     Exception occurred with following context: (TaskId:107)
                     Compilation: Debug_w1hn3hlk.m21 (TaskId:107)
                     ISymbol: <Main>$ (Method) (TaskId:107)
                     System.IndexOutOfRangeException: Index was outside the bounds of the array. (TaskId:107)
                     at ILLink.RoslynAnalyzer.DynamicallyAccessedMembersAnalyzer.<>c.<Initialize>b__7_3(SymbolAnalysisContext context) (TaskId:107)
                     at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info, CancellationToken cancellationToken) (TaskId:107)
                     ----- (TaskId:107)
                     Suppress the following diagnostics to disable this analyzer: IL2026, IL2032, IL2041, IL2043, IL2055, IL2057, IL2058, IL2059, IL2060, IL2062, IL2063, IL2064, IL2065, IL2066, IL2067, IL2068, IL2069, IL2070, IL2071, IL2072, IL2073, IL2074, IL2075, IL2076, IL2077, IL2078, IL2079, IL2080, IL2081, IL2082, IL2083, IL2084, IL2085, IL2086, IL2087, IL2088, IL2089, IL2090, IL2091, IL2092, IL2093, IL2094, IL2095, IL2096, IL2097, IL2098, IL2099, IL2103, IL2106, IL2110, IL2111 (TaskId:107)
                     CompilerServer: server - server processed compilation - 9624bd43-5dab-4d62-9e51-fbed45800538 (TaskId:107)
                   Done executing task "Csc" -- FAILED. (TaskId:107)
  • The failing build uses microsoft.net.illink.tasks/8.0.0-preview.6.23314.14, the changes for which include:

  • The last passing build on CI was for 3c2ebd5

    • which used sdk 8.0.100-preview.6.23314.19 to build WBT
  • I tested with fe866e6

    • which used sdk 8.0.100-preview.6.23315.7 to build WBT
  • The changes in sdk (6ce52a339247f9a848ff97fa418070b65de92b4d..1a17b18064c9bbf7dcb2155a03f2c92fe657fba1) include:

+    <Dependency Name="Microsoft.NET.ILLink.Tasks" Version="8.0.0-preview.6.23314.14">
       <Uri>https://github.com/dotnet/runtime</Uri>
-      <Sha>54dab738de58291ebefc8ff0569a799efaff5d82</Sha>
+      <Sha>0a0fa137097595ad8ec0e2aa9ecffb524cd5df95</Sha>
     </Dependency>

And that includes #87156 Fix trim analyzer warning for inferred type arguments #87156.

cc @sbomer

I will open a PR to use the older sdk for now, for Wasm.Build.Tests . And to trigger wasm jobs on linker changes.

Author: radical
Assignees: -
Labels:

arch-wasm, blocking-clean-ci, test-failure, area-Tools-ILLink

Milestone: -

@radical radical added the Known Build Error Use this to report build issues in the .NET Helix tab label Jun 15, 2023
@radical
Copy link
Member Author

radical commented Jun 15, 2023

@sbomer sbomer self-assigned this Jun 15, 2023
@eerhardt
Copy link
Member

I'm seeing the same thing using the latest SDK

dotnet new api
dotnet publish /p:PublishTrimmed=true /p:TrimMode=full /p:EnableRequestDelegateGenerator=true

@radical
Copy link
Member Author

radical commented Jun 15, 2023

context.RegisterSymbolAction (context => {
var method = (IMethodSymbol) context.Symbol;
if (method.IsInRequiresUnreferencedCodeAttributeScope (out _))
return;
var returnType = method.ReturnType;
foreach (var diagnostic in ProcessGenericParameters (returnType, method.Locations[0]))
context.ReportDiagnostic (diagnostic);
foreach (var parameter in method.Parameters) {
foreach (var diagnostic in ProcessGenericParameters (parameter.Type, parameter.Locations[0]))
context.ReportDiagnostic (diagnostic);
}
}, SymbolKind.Method);

Line 118 above is tripping on the entrypoint. Printing the method, and parameter.Locations.Length: <top-level-statements-entry-point>, 0.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 15, 2023
radical added a commit to radical/runtime that referenced this issue Jun 15, 2023
@lewing lewing added this to the 8.0.0 milestone Jun 16, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 16, 2023
radical added a commit that referenced this issue Jun 16, 2023
* [wasm] Fix inclusion of `marshal-ilgen`

Issue: `marshal-ilgen` component never included

Reason:
The item inclusion was being done *outside* any targets, which would get
evaluated *before* any targets are run.

But the item that it depends on to decide whether to include
`marshal-ilgen` is in target
`_ScanAssembliesDecideLightweightMarshaler`.

This broke microbenchmarks with:
```
Error: [MONO] * Assertion at /__w/1/s/src/mono/mono/component/marshal-ilgen-stub.c:28, condition `!m_type_is_byref(t)' not met

    at ft (/home/helixbot/work/96640802/w/B9C40A15/e/performance/artifacts/bin/for-running/MicroBenchmarks/fa21f9df-08d0-43a4-b28d-0078821ea492/bin/net8.0/browser-wasm/AppBundle/dotnet.runtime.js:3:12422)
    at mt (/home/helixbot/work/96640802/w/B9C40A15/e/performance/artifacts/bin/for-running/MicroBenchmarks/fa21f9df-08d0-43a4-b28d-0078821ea492/bin/net8.0/browser-wasm/AppBundle/dotnet.runtime.js:3:12676)
    at wasm_trace_logger (wasm://wasm/00a5f7d6:wasm-function[7879]:0x1e41d0)
    at eglib_log_adapter (wasm://wasm/00a5f7d6:wasm-function[581]:0x37fbb)
    at monoeg_g_logv_nofree (wasm://wasm/00a5f7d6:wasm-function[504]:0x35f57)
    at monoeg_assertion_message (wasm://wasm/00a5f7d6:wasm-function[508]:0x36078)
    at mono_assertion_message (wasm://wasm/00a5f7d6:wasm-function[510]:0x360bb)
    at stub_emit_marshal_ilgen (wasm://wasm/00a5f7d6:wasm-function[1300]:0x66db1)
    at mono_emit_marshal (wasm://wasm/00a5f7d6:wasm-function[1820]:0x8990b)
    at emit_native_wrapper_ilgen (wasm://wasm/00a5f7d6:wasm-function[2651]:0xb86de)
```

* [wasm] WBT: Use sdk 8.0.100-preview.6.23314.19

.. to workaround #87647 .

* [wasm] Add test for marshal-ilgen - wbt

* add missing file
@radical radical removed the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Jun 16, 2023
@radical
Copy link
Member Author

radical commented Jun 16, 2023

Removed blocking-clean-ci because #87629 fixed the sdk used for testing to the earlier working one.

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 17, 2023
radical added a commit to radical/runtime that referenced this issue Jun 29, 2023
This reverts the earlier change from
7112a41 which was working around
dotnet#87647
radical added a commit that referenced this issue Jun 29, 2023
This reverts the earlier change from
7112a41 which was working around
#87647
@lambdageek
Copy link
Member

lambdageek commented Jun 30, 2023

Is this issue actually fixed for normal uses of the wasmbrowser and wasmconsole templates? I still get this warning with 8.0.0-preview.6.23316.3. Ah I see #87659 was only merged to main not to the preview 6 branch.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Tools-ILLink .NET linker development as well as trimming analyzers Known Build Error Use this to report build issues in the .NET Helix tab test-failure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants