Closed Youssef1313 closed 1 year ago
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.
Author: | Youssef1313 |
---|---|
Assignees: | - |
Labels: | `area-System.Text.Json` |
Milestone: | - |
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries See info in area-owners.md if you want to be subscribed.
Author: | Youssef1313 |
---|---|
Assignees: | - |
Labels: | `area-Infrastructure-libraries`, `untriaged` |
Milestone: | - |
I can't reproduce locally. Does the warning come from compiling that netstandard2.0
project or someplace else?
This issue has been marked needs-author-action
and may be missing some important information.
@eiriktsarpalis Yes, only this simple project. Here are two binlogs, one when referencing 7.0.2 version of the package, and one when referencing 6.0.7
Could you provide a zipfile containing a reproducing project?
It is as simple as the issue description:
If you still can't reproduce, then I'm not sure what's different on my machine. Would a complog and initial investigation from Roslyn team help? Not really sure.
The attached project uses a different STJ version:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>
</Project>
But that still compiles on my machine without issue. Did you try cleaning your local state/NuGet caches before building again?
EDIT: I see you're providing binlogs for both versions, but like I said this works as expected for both package versions locally.
The attached project uses a different STJ version:
Yeah I forgot to change it back to 7.0.2 before zipping and uploading.
Hard for me to clear everything in NuGet cache, but I cleared the relevant ones: System.Text.Json and netstandard.library, and I can still reproduce.
@eiriktsarpalis Would you be able to try invoking Csc directly the same way as it is in the failing binlog and see if it reproduces that way?
C:\Program Files\dotnet\dotnet.exe exec "C:\Program Files\dotnet\sdk\8.0.100-preview.1.23115.2\Roslyn\bincore\csc.dll" /noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702 /fullpaths /nostdlib+ /errorreport:prompt /define:TRACE;DEBUG;NETSTANDARD;NETSTANDARD2_0;NETSTANDARD1_0_OR_GREATER;NETSTANDARD1_1_OR_GREATER;NETSTANDARD1_2_OR_GREATER;NETSTANDARD1_3_OR_GREATER;NETSTANDARD1_4_OR_GREATER;NETSTANDARD1_5_OR_GREATER;NETSTANDARD1_6_OR_GREATER;NETSTANDARD2_0_OR_GREATER /highentropyva+ /reference:C:\Users\PC\.nuget\packages\microsoft.bcl.asyncinterfaces\7.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\Microsoft.Win32.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\mscorlib.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\netstandard.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.AppContext.dll /reference:C:\Users\PC\.nuget\packages\system.buffers\4.5.1\ref\netstandard2.0\System.Buffers.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Collections.Concurrent.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Collections.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Collections.NonGeneric.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Collections.Specialized.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ComponentModel.Composition.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ComponentModel.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ComponentModel.EventBasedAsync.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ComponentModel.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ComponentModel.TypeConverter.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Console.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Core.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Data.Common.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Data.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.Contracts.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.Debug.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.FileVersionInfo.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.Process.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.StackTrace.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.TextWriterTraceListener.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.Tools.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.TraceSource.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Diagnostics.Tracing.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Drawing.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Drawing.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Dynamic.Runtime.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Globalization.Calendars.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Globalization.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Globalization.Extensions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.Compression.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.Compression.FileSystem.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.Compression.ZipFile.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.FileSystem.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.FileSystem.DriveInfo.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.FileSystem.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.FileSystem.Watcher.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.IsolatedStorage.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.MemoryMappedFiles.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.Pipes.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.IO.UnmanagedMemoryStream.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Linq.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Linq.Expressions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Linq.Parallel.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Linq.Queryable.dll /reference:C:\Users\PC\.nuget\packages\system.memory\4.5.5\lib\netstandard2.0\System.Memory.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Http.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.NameResolution.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.NetworkInformation.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Ping.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Requests.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Security.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.Sockets.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.WebHeaderCollection.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.WebSockets.Client.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.WebSockets.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Numerics.dll /reference:C:\Users\PC\.nuget\packages\system.numerics.vectors\4.5.0\ref\netstandard2.0\System.Numerics.Vectors.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ObjectModel.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Reflection.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Reflection.Extensions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Reflection.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Resources.Reader.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Resources.ResourceManager.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Resources.Writer.dll /reference:C:\Users\PC\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.CompilerServices.VisualC.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Extensions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Handles.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.InteropServices.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.InteropServices.RuntimeInformation.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Numerics.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Serialization.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Serialization.Formatters.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Serialization.Json.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Serialization.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Runtime.Serialization.Xml.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Claims.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Cryptography.Algorithms.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Cryptography.Csp.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Cryptography.Encoding.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Cryptography.Primitives.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Cryptography.X509Certificates.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.Principal.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Security.SecureString.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ServiceModel.Web.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Text.Encoding.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Text.Encoding.Extensions.dll /reference:C:\Users\PC\.nuget\packages\system.text.encodings.web\7.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll /reference:C:\Users\PC\.nuget\packages\system.text.json\7.0.2\lib\netstandard2.0\System.Text.Json.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Text.RegularExpressions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.Overlapped.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.Tasks.dll /reference:C:\Users\PC\.nuget\packages\system.threading.tasks.extensions\4.5.4\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.Tasks.Parallel.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.Thread.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.ThreadPool.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Threading.Timer.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Transactions.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.ValueTuple.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Web.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Windows.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.Linq.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.ReaderWriter.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.Serialization.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.XDocument.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.XmlDocument.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.XmlSerializer.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.XPath.dll /reference:C:\Users\PC\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Xml.XPath.XDocument.dll /debug+ /debug:portable /filealign:512 /optimize- /out:obj\Debug\netstandard2.0\ClassLibrary1.dll /target:library /warnaserror- /utf8output /deterministic+ /langversion:7.3 /analyzerconfig:obj\Debug\netstandard2.0\ClassLibrary1.GeneratedMSBuildEditorConfig.editorconfig /analyzer:C:\Users\PC\.nuget\packages\system.text.json\7.0.2\analyzers\dotnet\roslyn4.4\cs\System.Text.Json.SourceGeneration.dll Class1.cs "obj\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs" obj\Debug\netstandard2.0\ClassLibrary1.AssemblyInfo.cs /warnaserror+:NU1605
In case you are still not able to repro @eiriktsarpalis, @jaredpar would this be something you could investigate given a complog, or a complog won't help here? I'm assuming it could help since this is a compile error so we could work backwards to understand what is broken.
I'm unable to reproduce it on my machine. Can you provide a complog? It should reproduce this on our end.
@jaredpar ClassLibrary1.zip
@Youssef1313 excellent, I can reproduce locally
:\Users\jaredpar\temp\repro\.complog\ClassLibrary1\export
🍿🐻 > .\build-8.0.100-preview.1.23115.2.cmd
C:\Users\jaredpar\temp\repro\.complog\ClassLibrary1\export>dotnet exec "C:\Program Files\dotnet\sdk\8.0.100-preview.1.23115.2\Roslyn\bincore\csc.dll" @build.rsp
Microsoft (R) Visual C# Compiler version 4.6.0-1.23109.10 (73338d92)
Copyright (C) Microsoft Corporation. All rights reserved.
warning CS2023: Ignoring /noconfig option because it was specified in a response file
error CS1705: Assembly 'System.Text.Json' with identity 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' uses 'System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' which has a higher version than referenced assembly 'System.Memory' with identity 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
@Youssef1313 I think your NuGet package cache may be corrupted. The diagnostic is correct here that System.Memory with version 4.0.1.1 is provided but System.Text.Json requires 4.0.1.2. That's pretty clear from the complog. When I look at your binlog though you are getting your System.Memory reference from the following location:
C:\Users\PC.nuget\packages\system.memory\4.5.5\lib\netstandard2.0\System.Memory.dll
Locally when I build I get the same location (modulo user name)
C:\Users\jaredpar.nuget\packages\system.memory\4.5.5\lib\netstandard2.0\System.Memory.dll
My copy has version 4.0.1.2 as expected. As a tie breaker I downloaded System.Memory at 4.5.5 from nuget.org and checked the version it has: 4.0.1.2.
To me that indicates the most likely possibility here is your local copy of System.Memory package is corrupted. Or perhaps you installed a pre-release copy somehow. Either way I would nuke your local NuGet caches, rebuild and see if the error goes away.
It works after deleting C:\Users\PC\.nuget\packages\system.memory
and re-restoring. Thanks @jaredpar
I don't know how it got corrupted. Thanks a lot @jaredpar !
@ericstj FYI. Hopefully this is just a one off issue but I'm struggling to think how @Youssef1313 could have ended up with this invalid package on his machine. Wanted to give you a heads up in case you see similar issues in the future.
The NuGet package cache is writeable by the build, so bad behaved builds can do this. If you hit it again, an interesting datapoint would be to crack open that package to see if it is busted too. If the package has the wrong file then the problem is up-stream on some feed you're pulling the package from. If the package is correct - then something on your machine modified the package cache.
I've seen someone using hardlinks + a non-standard copy (open + write rather than OS copy API) accidentally modify their package cache before.
Description
Reproduction Steps
csproj:
cs:
Expected behavior
No error
Actual behavior
Regression?
Yes. Referencing 6.0.7 version of the package works. Likely regressed by https://github.com/dotnet/runtime/pull/73871
Known Workarounds
No response
Configuration
No response
Other information
No response