From 30a442095837202cb277f3d49e9a5b1e812dc204 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 11 Sep 2024 15:55:15 +0200 Subject: [PATCH 1/7] Update to .NET 9 rc1 --- .devcontainer/devcontainer.json | 6 +++--- global.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ac63d29017f..2600981e3c5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,12 +1,12 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: { "name": "F#", - "image": "mcr.microsoft.com/dotnet/sdk:9.0.100-preview.7", + "image": "mcr.microsoft.com/dotnet/sdk:9.0.100-rc.1", "features": { - "ghcr.io/devcontainers/features/common-utils:2.4.6": {}, + "ghcr.io/devcontainers/features/common-utils:2.5.1": {}, "ghcr.io/devcontainers/features/git:1.3.2": {}, "ghcr.io/devcontainers/features/github-cli:1.0.13": {}, - "ghcr.io/devcontainers/features/dotnet:2.1.2": {} + "ghcr.io/devcontainers/features/dotnet:2.1.3": {} }, "hostRequirements": { "cpus": 2, diff --git a/global.json b/global.json index f559dbefc56..bce954435c7 100644 --- a/global.json +++ b/global.json @@ -1,10 +1,10 @@ { "sdk": { - "version": "9.0.100-preview.7.24407.12", + "version": "9.0.100-rc.1.24452.12", "allowPrerelease": true }, "tools": { - "dotnet": "9.0.100-preview.7.24407.12", + "dotnet": "9.0.100-rc.1.24452.12", "vs": { "version": "17.8", "components": [ From 7ef700c584a4f7957ce4c160804c34f5a7bba807 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 11 Sep 2024 17:39:50 +0200 Subject: [PATCH 2/7] Update to .NET 9 rc1 --- Directory.Build.props | 6 +++++- FSharp.Profiles.props | 4 ++++ eng/Versions.props | 1 + src/FSharp.Build/FSharpEmbedResourceText.fs | 12 ++++++++++++ .../Interop/ByrefTests.fs | 6 +++--- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 573faa9eb9e..719838f0a0d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -46,7 +46,10 @@ false - true + + + false + true $(MSBuildThisFileDirectory)artifacts/ $(ArtifactsDir)/bin/$(MSBuildProjectName)/$(Configuration)/ @@ -57,6 +60,7 @@ $(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(RuntimeIdentifier)/fsyacc.dll NO_CHECKNULLS;BUILDING_WITH_LKG;NO_NULLCHECKING_LIB_SUPPORT;$(DefineConstants) + diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 811ee0d0e40..1d9eafa8c2b 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -22,6 +22,10 @@ $(OtherFlags) /langversion:preview + + false + + enable diff --git a/eng/Versions.props b/eng/Versions.props index c56fb4a3cd0..50b51a34787 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -87,6 +87,7 @@ 6.0.0 $(SystemPackageVersionVersion) 4.5.0 + 6.0.0 1.6.0 4.11.0-2.24264.2 diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index 60e871761c2..ac0adf8329d 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -288,7 +288,11 @@ open Printf if isNull s then System.Diagnostics.Debug.Assert(false, sprintf ""**RESOURCE ERROR**: Resource token %s does not exist!"" name) #endif + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + s + #else Unchecked.nonNull s + #endif static let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) = @@ -314,7 +318,11 @@ open Printf // PERF: this technique is a bit slow (e.g. in simple cases, like 'sprintf ""%x""') mkFunctionValue tys (fun inp -> impl rty inp) + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + static let capture1 (fmt:string) i args ty (go: obj list -> System.Type -> int -> obj) : obj = + #else static let capture1 (fmt:string) i args ty (go: objnull list -> System.Type -> int -> obj) : obj = + #endif match fmt.[i] with | '%' -> go args ty (i+1) | 'd' @@ -336,7 +344,11 @@ open Printf if i >= len || (fmt.[i] = '%' && i+1 >= len) then let b = new System.Text.StringBuilder() b.AppendFormat(messageString, [| for x in List.rev args -> x |]) |> ignore + #if BUILDING_WITH_LKG || NO_NULLCHECKING_LIB_SUPPORT + box(b.ToString()) + #else box(b.ToString()) |> Unchecked.nonNull + #endif // REVIEW: For these purposes, this should be a nop, but I'm leaving it // in incase we ever decide to support labels for the error format string // E.g., ""%s%d"" diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs index db89445122b..e5a278a4a85 100644 --- a/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Interop/ByrefTests.fs @@ -115,7 +115,7 @@ open System.Collections.Generic let myDict = ["x",1;"xyz",2] |> dict |> Dictionary let checkIfPresent (input:ReadOnlySpan) = - let altLookup = myDict.GetAlternateLookup>() + let altLookup = myDict.GetAlternateLookup>() let present = altLookup.ContainsKey(input) for c in input do printf "%c" c @@ -134,7 +134,7 @@ let main _args = |> shouldSucceed |> verifyOutputContains [|": false";"x: true";"xyz: true"|] |> verifyIL - ["call valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1 [System.Collections]System.Collections.Generic.CollectionExtensions::GetAlternateLookup>(class [System.Collections]System.Collections.Generic.Dictionary`2)"] + ["callvirt instance valuetype [System.Collections]System.Collections.Generic.Dictionary`2/AlternateLookup`1 class [System.Collections]System.Collections.Generic.Dictionary`2::GetAlternateLookup>()"] [] let ``Ref structs in generics - GetAlternateLookup`` () = @@ -144,7 +144,7 @@ open System.Collections.Generic let main _args = let myDict = ["x",1;"y",2] |> dict |> Dictionary - let altLookup = myDict.GetAlternateLookup>() + let altLookup = myDict.GetAlternateLookup>() altLookup.ContainsKey(ReadOnlySpan([|'x'|])) """ |> withLangVersionPreview From fc8f0bcac781d7974dd41adda410de7c9c6049d6 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Wed, 11 Sep 2024 17:43:02 +0200 Subject: [PATCH 3/7] Remove some leftovers --- eng/Versions.props | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 50b51a34787..c56fb4a3cd0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -87,7 +87,6 @@ 6.0.0 $(SystemPackageVersionVersion) 4.5.0 - 6.0.0 1.6.0 4.11.0-2.24264.2 From 7eafd9807e9f0d7ac43cba4f1bd24d671fe1266c Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 12 Sep 2024 14:12:53 +0200 Subject: [PATCH 4/7] Workaround for msbuild 17.11 issue + realsig off --- Directory.Build.targets | 25 +++++++++++++++++++++++++ eng/Build.ps1 | 2 +- eng/build.sh | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 8aed019a00f..52109a82ee6 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -52,4 +52,29 @@ StopOnFirstFailure="True" /> + + + + + + + + + + + + + diff --git a/eng/Build.ps1 b/eng/Build.ps1 index a6bda85ef6b..1c6872acd95 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -71,7 +71,7 @@ param ( [switch]$sourceBuild, [switch]$skipBuild, [switch]$compressAllMetadata, - [switch]$buildnorealsig, + [switch]$buildnorealsig = $true, [switch]$verifypackageshipstatus = $false, [parameter(ValueFromRemainingArguments = $true)][string[]]$properties) diff --git a/eng/build.sh b/eng/build.sh index 8544de1e72e..59d60b85189 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -71,7 +71,7 @@ skip_analyzers=false skip_build=false prepare_machine=false source_build=false -buildnorealsig=false +buildnorealsig=true properties="" docker=false From bc19bcf232de574397ca6bc406a3bc7920b5ca4e Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 12 Sep 2024 17:24:19 +0200 Subject: [PATCH 5/7] Trimming tests --- tests/AheadOfTime/Trimming/check.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1 index 0f37c11cf31..3df07cb2a5d 100644 --- a/tests/AheadOfTime/Trimming/check.ps1 +++ b/tests/AheadOfTime/Trimming/check.ps1 @@ -43,7 +43,7 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) { # error NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. # Check net7.0 trimmed assemblies -CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 287232 +CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 297984 # Check net8.0 trimmed assemblies CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8821248 From aa5a32403a6f3e3889614d375cb3adc50262eaba Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 12 Sep 2024 17:55:54 +0200 Subject: [PATCH 6/7] Trimming tests --- tests/AheadOfTime/Trimming/check.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1 index 3df07cb2a5d..f375accd624 100644 --- a/tests/AheadOfTime/Trimming/check.ps1 +++ b/tests/AheadOfTime/Trimming/check.ps1 @@ -46,4 +46,4 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len) { CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 297984 # Check net8.0 trimmed assemblies -CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 8821248 +CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9148416 From f1d639b899c0bc2f321b3926bc179ad27076ce4f Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Thu, 12 Sep 2024 21:04:15 +0200 Subject: [PATCH 7/7] revert realsig --- eng/Build.ps1 | 2 +- eng/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 1c6872acd95..a6bda85ef6b 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -71,7 +71,7 @@ param ( [switch]$sourceBuild, [switch]$skipBuild, [switch]$compressAllMetadata, - [switch]$buildnorealsig = $true, + [switch]$buildnorealsig, [switch]$verifypackageshipstatus = $false, [parameter(ValueFromRemainingArguments = $true)][string[]]$properties) diff --git a/eng/build.sh b/eng/build.sh index 59d60b85189..8544de1e72e 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -71,7 +71,7 @@ skip_analyzers=false skip_build=false prepare_machine=false source_build=false -buildnorealsig=true +buildnorealsig=false properties="" docker=false