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

[browser] Fix ConvertDllsToWebCil stack dump on bad input to be error message with input path #101162

Merged
merged 5 commits into from
May 4, 2024

Conversation

danmoseley
Copy link
Member

@danmoseley danmoseley commented Apr 17, 2024

Fix #101154

It looks like there are no unit tests for this assembly. Should we have them? It is exercised as a whole as part of all the Wasm.Build.Tests.

View diff with whitespace disabled: https://github.com/dotnet/runtime/pull/101162/files?diff=split&w=1

@danmoseley
Copy link
Member Author

Added a basic test. It has to be run manually right now, but it's a start and improvement over none.

@lewing
Copy link
Member

lewing commented Apr 17, 2024

The test assemblies are changing the prebuilts

@danmoseley
Copy link
Member Author

The test assemblies are changing the prebuilts

Not sure what that means. Is there an issue with this PR?

@maraf maraf changed the title Fix ConvertDllsToWebCil stack dump on bad input to be error message with input path [browser] Fix ConvertDllsToWebCil stack dump on bad input to be error message with input path Apr 19, 2024
@maraf maraf added arch-wasm WebAssembly architecture os-browser Browser variant of arch-wasm labels Apr 19, 2024
@maraf maraf added this to the 9.0.0 milestone Apr 19, 2024
@lewing
Copy link
Member

lewing commented Apr 19, 2024

The test assemblies are changing the prebuilts

Not sure what that means. Is there an issue with this PR?

I was referring to the failure of runtime-dev-innerloop (Build Source-Build (Linux_x64)) lane.

.packages/microsoft.dotnet.arcade.sdk/9.0.0-beta.24217.1/tools/SourceBuild/AfterSourceBuild.proj(81,5): error : (NETCORE_ENGINEERING_TELEMETRY=AfterSourceBuild) 14 new pre-builts discovered! Detailed usage report can be found at /__w/1/s/artifacts/sb/prebuilt-report/baseline-comparison.xml.
See https://aka.ms/dotnet/prebuilts for guidance on what pre-builts are and how to eliminate them.
Package IDs are:
Castle.Core.5.1.1
Microsoft.CodeCoverage.17.4.0-preview-20220707-01
Microsoft.NET.Test.Sdk.17.4.0-preview-20220707-01
Microsoft.TestPlatform.ObjectModel.17.4.0-preview-20220707-01
Microsoft.TestPlatform.TestHost.17.4.0-preview-20220707-01
Moq.4.18.4
System.Diagnostics.EventLog.6.0.0
xunit.analyzers.1.4.0
xunit.assert.2.6.7-pre.5
xunit.core.2.6.7-pre.5
xunit.extensibility.core.2.6.7-pre.5
xunit.extensibility.execution.2.6.7-pre.5
xunit.runner.console.2.6.7-pre.5
xunit.runner.visualstudio.2.5.7-pre.8

@@ -0,0 +1,31 @@

Copy link
Member

@ViktorHofer ViktorHofer Apr 24, 2024

Choose a reason for hiding this comment

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

Please don't check in solution files unless they are necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Generally folks will want both tests and impl projects open in VS. what's the recommended way to do that - create a solution manually?

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Member

Choose a reason for hiding this comment

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

If we do this, then I would move the src under src/tasks/src same as we do libraries under "src/libraries".

Comment on lines 9 to 12
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildFrameworkVersion)" />
<PackageReference Include="Moq" Version="$(MoqVersion)" />
</ItemGroup>
Copy link
Member

Choose a reason for hiding this comment

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

Because of this, this project gets always built, even in an official build which doesn't run tests. We want to minimize the external dependencies that we restore and use during an official build.

I think tasks.proj should be changed so that task tests are only built when requested.

Copy link
Member Author

Choose a reason for hiding this comment

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

What's the right way to do that?

Copy link
Member

@ViktorHofer ViktorHofer Apr 24, 2024

Choose a reason for hiding this comment

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

You would need to define a new subset in Subsets.props: tasks.tests. Then if that subset is passed in you can pass an additional property to tasks.proj:

<MSBuild Projects="$(RepoTasksDir)tasks.proj"

i.e.

<Properties Condition="...">IncludeTaskTests=true</Properties>

Then in tasks.proj you would change this line:

<ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" />

to something like

<ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" />
<ProjectReference Remove="$(MSBuildThisFileDirectory)tests\**\*.csproj" Condition="'$(IncludeTaskTests)' != 'true'" />

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

We don't have test infrastructure support for tasks. We would need to change Subsets.props and/or YML for that. It might be easier to just move the entire task and the tests under src/libraries.

cc @ericstj @jkoritzinsky @akoeplinger

@radical
Copy link
Member

radical commented Apr 24, 2024

old related issue - #79010

@danmoseley
Copy link
Member Author

I didn't set out to tackle the problem of creating test infrastructure here and probably don't have time. Thoughts about just checking in the fix without the test? Reasoning: none of the others have tests; this test passes when run explicitly.

@lewing ? I can create an issue to create test infra if I do this.

@maraf
Copy link
Member

maraf commented Apr 25, 2024

I didn't set out to tackle the problem of creating test infrastructure here and probably don't have time. Thoughts about just checking in the fix without the test? Reasoning: none of the others have tests; this test passes when run explicitly.

I sounds good to me.

@lewing
Copy link
Member

lewing commented Apr 26, 2024

I didn't set out to tackle the problem of creating test infrastructure here and probably don't have time. Thoughts about just checking in the fix without the test? Reasoning: none of the others have tests; this test passes when run explicitly.

@lewing ? I can create an issue to create test infra if I do this.

The fix is fine, and while tests for the tasks feel simple sometimes the things that feel simple are actually harder than their benefit.

@danmoseley
Copy link
Member Author

OK, I reverted the tests but left in history in this PR so they can be grabbed in future when someone sets up unit tests for this assembly.

@lewing
Copy link
Member

lewing commented May 3, 2024

merging main again because this should pass now and I'd like to see the results if it doesn't

@danmoseley
Copy link
Member Author


[03:45:34] info: Starting:    managed/Invariant.Tests.dll
[03:45:34] info: Error: failed to run main module `dotnet.wasm`
[03:45:34] info: 
[03:45:34] info: Caused by:
[03:45:34] info:     0: failed to invoke command default
[03:45:34] info:     1: error while executing at wasm backtrace:
[03:45:34] info:            0: 0x1084b49 - <unknown>!corlib_System_RuntimeType_CreateInstanceImpl_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo
[03:45:34] info:            1: 0x11510e7 - <unknown>!corlib_System_Activator_CreateInstance_System_Type_System_Reflection_BindingFlags_System_Reflection_Binder_object___System_Globalization_CultureInfo_object__
[03:45:34] info:            2: 0x11507de - <unknown>!corlib_System_Activator_CreateInstance_System_Type_object__

@lewing
Copy link
Member

lewing commented May 3, 2024

@ilonatommy please take a look

@danmoseley danmoseley merged commit 358b0a4 into dotnet:main May 4, 2024
33 checks passed
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConvertDllsToWebCil fails ugly for invalid assembly
6 participants