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

[iOS] Enable Diagnostics.Tracing tests #72545

Merged
merged 10 commits into from
Jul 25, 2022

Conversation

steveisok
Copy link
Member

Fixes an issue where a test project that contains native libraries will fool the AOT compiler task in thinking there are assemblies in different locations. This causes .aotdata files to not be bundled with the test app and ends up causing a runtime assertion.

Fixes #51382

Fixes an issue where a test project that contains native libraries will fool the AOT compiler task in thinking there are assemblies in different locations. This causes .aotdata files to not be bundled with the test app and ends up causing a runtime assertion.
@steveisok steveisok requested a review from radical as a code owner July 20, 2022 20:49
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost assigned steveisok Jul 20, 2022
@steveisok steveisok requested a review from mdh1418 July 20, 2022 20:49
@steveisok
Copy link
Member Author

@radical I'm not sure if switching the Filter / Ensure methods are going to impact you.

@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical
Copy link
Member

radical commented Jul 20, 2022

@radical I'm not sure if switching the Filter / Ensure methods are going to impact you.

I think it should be fine. FilterAssemblies does not try to load any dependencies, so location shouldn't matter. But let's see what the tests say :)

@radical
Copy link
Member

radical commented Jul 20, 2022

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/libraries/tests.proj Show resolved Hide resolved
@ghost ghost added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jul 20, 2022
@mdh1418
Copy link
Member

mdh1418 commented Jul 20, 2022

We can reenable these as well #56073
We just need to add RuntimeComponents="$(RuntimeComponents)" to AppleAppBuilderTask in AppleApp.targets and setting this property in System.Diagnostics.Tracing.Tests.csproj <RuntimeComponents>diagnostics_tracing</RuntimeComponents>

We probably also need to add <EventSourceSupport>true</EventSourceSupport> if the test suite fails with EnableAggressiveTrimming=true

@radical
Copy link
Member

radical commented Jul 21, 2022

Precompiling failed for /datadisks/disk1/work/A48F08FA/w/A9BB08F7/e/blazorwasm_Release_aot/obj/Release/net7.0/wasm/for-publish/aot-in/Microsoft.AspNetCore.Components.WebAssembly.dll with exit code 1.
Failed to load method 0x6000065 from '/datadisks/disk1/work/A48F08FA/w/A9BB08F7/e/blazorwasm_Release_aot/obj/Release/net7.0/wasm/for-publish/aot-in/Microsoft.AspNetCore.Components.WebAssembly.dll' due to Could not load file or assembly 'Microsoft.JSInterop.WebAssembly, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies..
Run with MONO_LOG_LEVEL=debug for more information.
AOT of image Microsoft.AspNetCore.Components.WebAssembly.dll failed.
Mono Ahead of Time compiler - compiling assembly /datadisks/disk1/work/A48F08FA/w/A9BB08F7/e/blazorwasm_Release_aot/obj/Release/net7.0/wasm/for-publish/aot-in/Microsoft.AspNetCore.Components.WebAssembly.dll

Hm Failed to load method 0x6000065 from '/datadisks/disk1/work/A48F08FA/w/A9BB08F7/e/blazorwasm_Release_aot/obj/Release/net7.0/wasm/for-publish/aot-in/Microsoft.AspNetCore.Components.WebAssembly.dll' due to Could not load file or assembly 'Microsoft.JSInterop.WebAssembly, ..

Microsoft.JSInterop.WebAssembly is skipped for AOT, but looks like it is still needed by mono-aot-cross. Hm I'll push a fix for this.

@radical
Copy link
Member

radical commented Jul 21, 2022

Fixes an issue where a test project that contains native libraries will fool the AOT compiler task in thinking there are assemblies in different locations. This causes .aotdata files to not be bundled with the test app and ends up causing a runtime assertion.

Could you explain what exactly is happening here?

  • test project contains native dlls, in location different from the managed assemblies
  • which makes the aot compiler task to move all of them (including the native ones) to a single directory
  • but how does that affect the aotdata being bundled?

…assemblies

`iOS` targets depend on these files being next to the original assemblies. But
that assumption breaks when `MonoAOTCompiler` copies the assemblies to `aot-in`
directory, and emits the `.aotdata` files there.
.. unmanaged assemblies.

1. Completely ignore unmanaged assemblies
2. Assemblies to be skipped for AOT, should still get copied to `aot-in`
dir. If this is not done, then blazor apps would break because they
skip` Microsoft.JSInterop.WebAssembly` but other assemblies depend on
it, thus causing `mono-aot-cross` to fail because it can't find the
JSInterop assembly.
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jul 21, 2022
@radical
Copy link
Member

radical commented Jul 21, 2022

I have pushed some changes that fixes the issue in two ways:

  1. The .aotdata files will be emitted next to the original assemblies
  2. Unmanaged assemblies won't be used to decide whether we need to move all the assemblies to a aot-in directory

@radical
Copy link
Member

radical commented Jul 21, 2022

/azp run runtime-extra-platforms,runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical
Copy link
Member

radical commented Jul 22, 2022

/azp run runtime-extra-platforms,runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@steveisok
Copy link
Member Author

System.Diagnostics.Tracing tests pass on tvOS. The other failures are unrelated.

Copy link
Member

@mdh1418 mdh1418 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! If we can add new issues/reference existing ones for any new project/test skips that'd be good.

Comment on lines +281 to +293
<!--
System.Formats.Cbor crashes on tvOS
-->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Formats.Cbor\tests\System.Formats.Cbor.Tests.csproj" />

<!--
Test apps that are too large and take too long to build
Keep here until aggressive trimming targets can work on helix.
-->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.RegularExpressions\tests\UnitTests\System.Text.RegularExpressions.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Text.Json\tests\System.Text.Json.SourceGeneration.Tests\System.Text.Json.SourceGeneration.Roslyn4.0.Tests.csproj" />


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these new failures? Are there issues associated that we can put in the comments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's just links that we need to add, then we can do that in a follow up PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be. I would rather address it in #67861

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

Successfully merging this pull request may close these issues.

System.Diagnostics.Tracing.Tests Fails on iOS and tvOS
3 participants