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

Refactor wasmappbuilder's System.Text.Json reference to use a versions.props property #70582

Merged

Conversation

MichaelSimons
Copy link
Member

The current hardcoded version reference causes issues with source-build:

  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605: Detected package downgrade: System.Text.Json from 7.0.0-preview.5.22272.3 to 6.0.0. Reference the package directly from the project to select a different version.  [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]
  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605:  WasmAppBuilder -> Microsoft.Build 17.3.0-preview-22263-02 -> System.Text.Json (>= 7.0.0-preview.5.22272.3)  [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]
  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605:  WasmAppBuilder -> System.Text.Json (>= 6.0.0) [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]

Refactoring the wasmappbuilder.csproj to utilize a versions.props property for the System.Text.Json version will correct this issue.

@radical
Copy link
Member

radical commented Jun 10, 2022

Why doesn't this fail for the non-source-build? Also, this needs to be tested on windows too. @lambdageek do you think this might cause any issues on windows?

@radical radical added the arch-wasm WebAssembly architecture label Jun 10, 2022
@ghost
Copy link

ghost commented Jun 10, 2022

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

Issue Details

The current hardcoded version reference causes issues with source-build:

  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605: Detected package downgrade: System.Text.Json from 7.0.0-preview.5.22272.3 to 6.0.0. Reference the package directly from the project to select a different version.  [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]
  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605:  WasmAppBuilder -> Microsoft.Build 17.3.0-preview-22263-02 -> System.Text.Json (>= 7.0.0-preview.5.22272.3)  [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]
  /repos/tarball/src/runtime/artifacts/source-build/self/src/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj : error NU1605:  WasmAppBuilder -> System.Text.Json (>= 6.0.0) [/repos/tarball/src/runtime/artifacts/source-build/self/src/Build.proj]

Refactoring the wasmappbuilder.csproj to utilize a versions.props property for the System.Text.Json version will correct this issue.

Author: MichaelSimons
Assignees: MichaelSimons
Labels:

arch-wasm, area-Build-mono

Milestone: -

@radical
Copy link
Member

radical commented Jun 10, 2022

Linux/AOT test failing with:

System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute' from assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable)
   at System.Reflection.CustomAttribute.IsDefined(RuntimeType type, RuntimeType caType, Boolean inherit)
   at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat, StringBuilder sb)
   at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat)
   at System.Exception.get_StackTrace()
   at System.Exception.ToString()
   at Microsoft.Build.BackEnd.Logging.LoggingService.LogFatalError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, String messageResourceName, Object[] messageArgs)
   at Microsoft.Build.BackEnd.Logging.LoggingService.LogFatalTaskError(BuildEventContext buildEventContext, Exception exception, BuildEventFileInfo file, String taskName)
   at Microsoft.Build.BackEnd.Logging.BuildLoggingContext.LogFatalTaskError(Exception exception, BuildEventFileInfo file, String taskName)
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
   at Microsoft.Build.BackEnd.TaskBuilder.InitializeAndExecuteTask(TaskLoggingContext taskLoggingContext, ItemBucket bucket, IDictionary`2 taskIdentityParameters, TaskHost taskHost, TaskExecutionMode howToExecuteTask)
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteBucket(TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Dictionary`2 lookupHash)
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteTask(TaskExecutionMode mode, Lookup lookup)
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteTask(TargetLoggingContext loggingContext, BuildRequestEntry requestEntry, ITargetBuilderCallback targetBuilderCallback, ProjectTargetInstanceChild taskInstance, TaskExecutionMode mode, Lookup inferLookup, Lookup executeLookup, CancellationToken cancellationToken)
   at Microsoft.Build.BackEnd.TargetEntry.ProcessBucket(ITaskBuilder taskBuilder, TargetLoggingContext targetLoggingContext, TaskExecutionMode mode, Lookup lookupForInference, Lookup lookupForExecution)
   at Microsoft.Build.BackEnd.TargetEntry.ExecuteTarget(ITaskBuilder taskBuilder, BuildRequestEntry requestEntry, ProjectLoggingContext projectLoggingContext, CancellationToken cancellationToken)
   at Microsoft.Build.BackEnd.TargetBuilder.ProcessTargetStack(ITaskBuilder taskBuilder)
   at Microsoft.Build.BackEnd.TargetBuilder.BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, String[] targetNames, Lookup baseLookup, CancellationToken cancellationToken)
   at Microsoft.Build.BackEnd.RequestBuilder.BuildProject()
   at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport()

@radical
Copy link
Member

radical commented Jun 10, 2022

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lambdageek
Copy link
Member

Why doesn't this fail for the non-source-build? Also, this needs to be tested on windows too. @lambdageek do you think this might cause any issues on windows?

The issue on windows in the past was when we requested a version that was newer than what comes with the visual studio version of msbuild - which caused problems with running the task from inside VS.

@radical radical added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 14, 2022
@ghost ghost added the no-recent-activity label Jun 28, 2022
@ghost
Copy link

ghost commented Jun 28, 2022

This pull request has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@@ -21,7 +21,7 @@
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="4.7.1" />
<PackageReference Include="System.Text.Json" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" PrivateAssets="all" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" PrivateAssets="all" />
<!-- When we requested a version that is newer than what comes with Visual Studio version of msbuild, it causes problems with
running the task from inside VS. Therefore, we are using the moving version only for source-build. -->
<PackageReference Include="System.Text.Json" Condition="'$(DotNetBuildFromSource)' != 'true'" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Condition="'$(DotNetBuildFromSource)' == 'true'" Version="$(SystemTextJsonVersion)" PrivateAssets="all" />

@lambdageek this?

Copy link
Member

Choose a reason for hiding this comment

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

That seems reasonable to me, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I applied the suggested pattern.

@ghost ghost removed the no-recent-activity label Jul 7, 2022
@ghost ghost added the no-recent-activity label Jul 21, 2022
@ghost
Copy link

ghost commented Jul 21, 2022

This pull request has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@ghost ghost removed the no-recent-activity label Jul 21, 2022
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jul 27, 2022
@@ -20,8 +20,12 @@

<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="4.7.1" />
<PackageReference Include="System.Text.Json" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataLoadContextVersion)" />
Copy link
Member Author

Choose a reason for hiding this comment

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

I realized we need to do the same for the MetadataLoadContext. Can this reference a shared versions.props property of should if follow the suggested source-build conditioned pattern?

@MichaelSimons MichaelSimons requested review from kasperk81 and lambdageek and removed request for kasperk81 August 3, 2022 19:39
@MichaelSimons
Copy link
Member Author

@kasperk81, @lambdageek - Any objects to merging this PR?

@radical
Copy link
Member

radical commented Aug 5, 2022

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@radical radical merged commit 667c170 into dotnet:main Aug 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 5, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants