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

System.Text.Json.SourceGeneration.Unit.Tests are disabled in WASM #58226

Closed
eerhardt opened this issue Aug 27, 2021 · 2 comments
Closed

System.Text.Json.SourceGeneration.Unit.Tests are disabled in WASM #58226

eerhardt opened this issue Aug 27, 2021 · 2 comments
Labels
area-System.Text.Json disabled-test The test is disabled in source code against the issue
Milestone

Comments

@eerhardt
Copy link
Member

Our System.Text.Json.SourceGeneration.Tests use the following to add references to the compilation:

List<MetadataReference> references = new List<MetadataReference> {
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Type).Assembly.Location),
MetadataReference.CreateFromFile(typeof(KeyValuePair).Assembly.Location),
MetadataReference.CreateFromFile(typeof(ContractNamespaceAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(JavaScriptEncoder).Assembly.Location),

This doesn't work in browser-wasm because Assembly.Location returns string.Empty. Thus we get exceptions that empty string is not a valid file path.

If we feel we need to run these tests on browser-wasm, we need to figure out a way to reference these assemblies so Roslyn can compile code.

cc @lewing @radical

@eerhardt eerhardt added area-System.Text.Json disabled-test The test is disabled in source code against the issue labels Aug 27, 2021
@ghost
Copy link

ghost commented Aug 27, 2021

Tagging subscribers to this area: @eiriktsarpalis, @layomia
See info in area-owners.md if you want to be subscribed.

Issue Details

Our System.Text.Json.SourceGeneration.Tests use the following to add references to the compilation:

List<MetadataReference> references = new List<MetadataReference> {
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Attribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(Type).Assembly.Location),
MetadataReference.CreateFromFile(typeof(KeyValuePair).Assembly.Location),
MetadataReference.CreateFromFile(typeof(ContractNamespaceAttribute).Assembly.Location),
MetadataReference.CreateFromFile(typeof(JavaScriptEncoder).Assembly.Location),

This doesn't work in browser-wasm because Assembly.Location returns string.Empty. Thus we get exceptions that empty string is not a valid file path.

If we feel we need to run these tests on browser-wasm, we need to figure out a way to reference these assemblies so Roslyn can compile code.

cc @lewing @radical

Author: eerhardt
Assignees: -
Labels:

area-System.Text.Json, disabled-test

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 27, 2021
@lewing lewing added this to the Future milestone Aug 27, 2021
@eiriktsarpalis eiriktsarpalis removed the untriaged New issue has not been triaged by the area owner label Aug 27, 2021
@layomia layomia changed the title System.Text.Json.SourceGeneration.Tests are disabled in WASM System.Text.Json.SourceGeneration.Unit.Tests are disabled in WASM Sep 16, 2021
@elinor-fung
Copy link
Member

elinor-fung commented Oct 19, 2021

This is the case for all source generator unit tests that need to set up a compilation as part of the test, not just the System.Text.Json ones. Some of the others are disabled for other reasons beyond the Assembly.Location usage, but they do all currently Assembly.Location in some way to set up the references needed for compilation.

radical added a commit to radical/runtime that referenced this issue Oct 27, 2021
- `Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests`
- `Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests`
- `System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests`
- `System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests`
- `System.Text.RegularExpressions.Generators.Tests`

Some individual ones are disabled due to
dotnet#58226, and
dotnet#60899 .

Fixes dotnet#51961 .
radical added a commit that referenced this issue Nov 2, 2021
This adds support for setting per-project optimization flags, and sets them for these projects so they don't OOM.

Microsoft.Extensions.Logging.Generators.Roslyn3.11.Tests
Microsoft.Extensions.Logging.Generators.Roslyn4.0.Tests
System.Text.Json.SourceGeneration.Roslyn3.11.Unit.Tests
System.Text.Json.SourceGeneration.Roslyn4.0.Unit.Tests
System.Text.RegularExpressions.Generators.Tests
Some individual ones are disabled due to
#58226, and #60899 .

Additionally, if a AOT build fails, then on linux it dumps the last few lines from dmesg, to help identify it was an oom-kill.

Fixes #51961 .

Co-authored-by: Larry Ewing <[email protected]>
@lewing lewing closed this as completed Jul 25, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json disabled-test The test is disabled in source code against the issue
Projects
None yet
Development

No branches or pull requests

4 participants