-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[wasm][mt] Fix System.Threading.Tasks.Parallel build #97505
Merged
radekdoulik
merged 6 commits into
dotnet:main
from
radekdoulik:pr-wasm-mt-fix-sttp-build
Jan 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5644f37
[wasm][mt] Fix System.Threading.Tasks.Parallel build
radekdoulik 8f40d96
Enable 5 more tests
radekdoulik 90ac6c9
Merge branch 'main' into pr-wasm-mt-fix-sttp-build
radekdoulik 7d52b40
Merge branch 'main' into pr-wasm-mt-fix-sttp-build
radekdoulik ec393b7
Feedback
radekdoulik 3a840ad
Fix typo
radekdoulik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the old thing,
TargetPlatformIdentifier
? Was it empty? I found:runtime/docs/coding-guidelines/project-guidelines.md
Line 117 in 135fec0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do it consistently in all project files if
TargetPlatformIdentifier
doesn't work well ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is the platform identifier from $(TargetFramework). I think it would have the value 'browser' if the target framework was something like
net9.0-browser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting.
TargetFramework
is not in the form ofnet9.0-browser
. We have quite a few places where we use the same condition, not connected with threading. It should mean that they are not triggered, e.g.runtime/src/libraries/System.Net.WebSockets/src/System.Net.WebSockets.csproj
Line 51 in 135fec0
runtime/src/libraries/System.Runtime.InteropServices.JavaScript/src/System.Runtime.InteropServices.JavaScript.csproj
Line 19 in 135fec0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@radekdoulik i didn't understand why/how you resolved this. We have many same conditions in the other project files. Do they all work or not ? Could we have them consistent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discourage using
TargetOS
to vary builds (except in some special cases for tests) because it defaults to the host OS if a target OS is not explicitly passed in, which is the case if you build a library from VS or in the "allConfiguration" CI build.The correct solution here is to add
$(NetCoreAppCurrent)-browser
TFM and useTargetPlatformIdentifier
in the condition.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akoeplinger, @lewing I am curious, how are the produced assemblies used further in the process. So in this case, where does the assembly built with net9.0 TFM ends up and where the net9.0-browser one. I imagine they end up in the right Sdk and workload so that users projects get the right assembly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see many
<IgnoreForCI Condition="'$(TargetOS)' == 'browser'">true</IgnoreForCI>
but I don't know whatIgnoreForCI
does.There are also many
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(TargetOS)' == 'browser'">true</DebuggerSupport>
Overall we have
'$(TargetOS)' != 'browser'
15x and'$(TargetOS)' == 'browser'
126xShould we fix it all ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the build system will select the right assets when building a specific runtime pack, based on the RID fallback graph in PortableRuntimeIdentifierGraph.json
IgnoreForCI skips sending a test project to helix, it is just an optimization for projects where all tests are disabled/skipped for whatever reason so that we don't waste resources sending and running a helix workitem where 0 tests are executed.
In theory the correct way would be to add additional browser TFMs here too but it'd make build times longer and test projects are always built for a specific target OS so we let it slide. The important part is that we only do this in tests, not in the src csproj. I've checked and only System.Linq.Parallel.csproj is affected (#97539 has the fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And just to be clear: the current way "works" because in CI/official builds we'll always have
TargetOS=browser
, the correct way is mostly important for VS scenarios e.g. you should be able to use the TFM dropdown in VS to select a different config and hit build to build the "browser' version, this likely won't work today anyway because of additional properties like MonoWasmBuildVariant.