Open OkkeHendriks opened 2 days ago
I just tried installing visual studio preview 17.12.0 preview 4.0. When building from within this VS version I do get the expected output and do not hit the bug.
Microsoft Visual Studio Enterprise 2022
Version 17.12.0 Preview 4.0
VisualStudio.17.Preview/17.12.0-pre.4.0+35417.141
Microsoft .NET Framework
Version 4.8.09037
Installing the preview installed an additional SDK and runtime, the list:
@ main$ dotnet --list-sdks
8.0.300 [C:\Program Files\dotnet\sdk]
8.0.304 [C:\Program Files\dotnet\sdk]
8.0.306 [C:\Program Files\dotnet\sdk]
8.0.403 [C:\Program Files\dotnet\sdk]
9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
okkhen@CLNT7418:/d/git/equals
@ main$ dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
It seems that somehow VS 17.11.5 is using the wrong SDK version?
Yeah, it's the same issue and was fixed in the later VS
What I don’t understand is that it should build using the SDK indicated by ‘global.json’ right?
What I don’t understand is that it should build using the SDK indicated by ‘global.json’ right?
It should, yes, but it might theoretically pick different locations for compiler itself (shipped with VS vs standalone) as well as different compilers (desktop/coreclr), it's currently hard to say what compiler was picked up for which version without binlog, we have quite complex logic for that.
Please provide a succinct description of the issue.
MethodAccessException on equality comparison of a record with private fields but only when building from visual studio (17.11.5). This is (probably) somehow related to this issue https://github.com/dotnet/fsharp/issues/17447 The SDK should be pinned at 8.0.300 by the
global.json
file, this version should not have this problem I believe.Provide the steps required to reproduce the problem:
Currently installed sdks and runtimes:
Installed Version: Enterprise
Visual C++ 2022 00476-80000-00000-AA437 Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.11.231.19466 ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.11.231.19466 Azure App Service Tools v3.0.0
C# Tools 4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
GitHub Copilot 0.2.1657.32929 GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.
Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
NuGet Package Manager 6.11.1 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.11.3.2442001+68650a7d94261bc56a1f4bc522c2ee35314b1abb Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.11.47.0 Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0 Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.30715.2002 TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.11.0-3.24460.3+5649376e0e5f5db3743a94a62b073f2cce4be5d9 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.11.0-beta.24421.7+af2f522de602281d4ef5a7b71507c428e814c5c1 Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.
@ main$ Console/bin/Debug/net8.0/Console.exe Comparing two values from a defined in a referenced library with a private constructor. Not equal
Comparing two values from a defined in a referenced library with a private constructor. Unhandled exception. System.MethodAccessException: Attempt by method 'Program.main(System.String[])' to access method 'LibA+TypeWithPrivateConstructor.Equals(TypeWithPrivateConstructor, System.Collections.IEqualityComparer)' failed. at Program.main(String[] _arg1) in D:\git\equals\Console\Program.fs:line 9