From 6b010560b19cd182d4b8224ec9eefc8947bcbecb Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 07:31:33 +0200 Subject: [PATCH 01/11] Emit FS0755 for CompiledName on multi-value let-bindings (#19924) --- .../.FSharp.Compiler.Service/11.0.100.md | 1 + .../Checking/Expressions/CheckExpressions.fs | 19 +++++ .../Attributes/CompiledNameMultipleValues.fs | 73 +++++++++++++++++++ .../FSharp.Compiler.ComponentTests.fsproj | 1 + 4 files changed, 94 insertions(+) create mode 100644 tests/FSharp.Compiler.ComponentTests/Attributes/CompiledNameMultipleValues.fs diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 33aaddcf5a9..1e8d013cf63 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,5 +1,6 @@ ### Fixed +* Fix `[]` silently producing duplicate IL entries (FS0192/FS2014) when applied to a multi-value let-binding (e.g. `let a, b = 1, 2`); now emits FS0755 at type-check time. ([Issue #6131](https://github.com/dotnet/fsharp/issues/6131), [PR #19924](https://github.com/dotnet/fsharp/pull/19924)) * Fix FS3236 when taking the address of an untyped generalized `let` binding (e.g. `let ffff = ValueNone`) passed to an `inref` parameter. ([Issue #19608](https://github.com/dotnet/fsharp/issues/19608), [PR #19948](https://github.com/dotnet/fsharp/pull/19948)) * Fix IntelliSense not suggesting later named arguments after the first one is autocompleted, for methods (including overloaded methods like `Task.Factory.StartNew`). ([Issue #19906](https://github.com/dotnet/fsharp/issues/19906), [PR #19940](https://github.com/dotnet/fsharp/pull/19940)) * Restore packaging of an F# design-time type provider that is activated via a `ProjectReference` carrying `IsFSharpDesignTimeProvider="true"`. The provider assembly is again included under `fsharp41` when packing (including `pack --no-build`); `PackageFSharpDesignTimeTools` now resolves the provider via `GetTargetPath`, which works in `dotnet pack`'s `BuildProjectReferences=false` content build without forcing an early `ResolveReferences`. ([Issue #18924](https://github.com/dotnet/fsharp/issues/18924), [PR #19979](https://github.com/dotnet/fsharp/pull/19979)) diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index 1b1007c6729..aba29d0aa86 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -1535,6 +1535,25 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec vspec let MakeAndPublishVals (cenv: cenv) env (altActualParent, inSig, declKind, valRecInfo, valSchemes, attrs, xmlDoc, literalValue) = + let g = cenv.g + + // [] on a binding that publishes more than one val (e.g. tuple, + // record, list, cons, `let x as y = ...` destructures, multi-case active patterns) + // would silently propagate the same compiled name to every introduced value and + // produce duplicate IL entries (FS0192/FS2014) during codegen. Catch it here where + // the post-generalization val count is authoritative. See dotnet/fsharp#6131. + if Map.count valSchemes > 1 then + match attrs with + | ValAttribString g WellKnownValAttributes.CompiledNameAttribute _ -> + let m = + match Map.toList valSchemes with + | [] -> range0 + | (_, ValScheme(id = id)) :: rest -> + (id.idRange, rest) + ||> List.fold (fun acc (_, ValScheme(id = id)) -> unionRanges acc id.idRange) + errorR(Error(FSComp.SR.tcCompiledNameAttributeMisused(), m)) + | _ -> () + Map.foldBack (fun name (valscheme: ValScheme) values -> Map.add name (MakeAndPublishVal cenv env (altActualParent, inSig, declKind, valRecInfo, valscheme, attrs, xmlDoc, literalValue, false), valscheme.GeneralizedType) values) diff --git a/tests/FSharp.Compiler.ComponentTests/Attributes/CompiledNameMultipleValues.fs b/tests/FSharp.Compiler.ComponentTests/Attributes/CompiledNameMultipleValues.fs new file mode 100644 index 00000000000..9628a248599 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Attributes/CompiledNameMultipleValues.fs @@ -0,0 +1,73 @@ +namespace FSharp.Compiler.ComponentTests.Attributes + +open Xunit +open FSharp.Test.Compiler + +module CompiledNameMultipleValues = + + [] + []\nlet a, b = 1, 2")>] + []\nlet (a, b) = 1, 2")>] + []\nlet ((a, b), c) = (1, 2), 3")>] + []\nlet { F = a; G = b } = { F = 1; G = 2 }")>] + []\nlet (Pair(a, b)) = Pair(1, 2)")>] + []\nlet (Some (a, b)) = Some (1, 2)")>] + []\nlet [| a; b |] = [| 1; 2 |]")>] + []\nlet a :: b = [1; 2]")>] + []\nlet (x as y) = 1")>] + let ``CompiledName on multi-value let-binding produces FS0755`` (source: string) = + FSharp source + |> typecheck + |> shouldFail + |> withErrorCode 755 + |> ignore + + [] + let ``CompiledName on tuple binding fires FS0755 exactly once`` () = + let source = "module M\n[]\nlet a, b, c = 1, 2, 3" + let result = + FSharp source + |> typecheck + |> shouldFail + + let diag755Count = + result.Output.Diagnostics + |> List.filter (fun d -> d.Error = Error 755) + |> List.length + Assert.Equal(1, diag755Count) + + [] + let ``CompiledName on single-value let-binding still compiles`` () = + FSharp "module M\n[]\nlet a = 1" + |> compile + |> shouldSucceed + |> withWarnings [] + |> ignore + + [] + [] + [] + [] + let ``Multi-value let-binding without CompiledName still compiles`` (source: string) = + FSharp source + |> compile + |> shouldSucceed + |> withWarnings [] + |> ignore + + [] + []\nlet (Some x) = Some 1")>] + []\nlet (Box x) = Box 1")>] + []\nlet a, _ = 1, 2")>] + []\nlet { F = a } = { F = 1; G = 2 }")>] + []\nlet [| a |] = [| 1 |]")>] + []\nlet a :: _ = [1; 2]")>] + []\nlet (|Even|Odd|) n = if n % 2 = 0 then Even else Odd")>] + let ``CompiledName on single-value destructure does not fire FS0755`` (source: string) = + let result = FSharp source |> typecheck + let diags = + match result with + | CompilationResult.Success r -> r.Diagnostics + | CompilationResult.Failure r -> r.Diagnostics + let fs755 = diags |> List.filter (fun d -> d.Error = Error 755) + Assert.Empty(fs755) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 0908b6600ea..f045130aa8e 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -516,6 +516,7 @@ + From 19565c12541fb3f408ea7a45716c184fe3f0ad46 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 07:31:55 +0200 Subject: [PATCH 02/11] Show [] and constant value for IL fields in Go to Metadata (#19922) --- .../.FSharp.Compiler.Service/11.0.100.md | 1 + src/Compiler/Checking/NicePrint.fs | 8 ++- .../FSharp.Compiler.Service.Tests/Symbols.fs | 72 +++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 1e8d013cf63..dcde4f5e785 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -111,6 +111,7 @@ * Warn FS3888 when a compiler-semantic attribute on a value/member or type/module is present in the `.fs` but missing from the `.fsi`. Such attributes were previously ignored at the consumer side. Under the `ErrorOnMissingSignatureAttribute` preview language feature, FS3888 is an error. ([Issue #19560](https://github.com/dotnet/fsharp/issues/19560), [PR #19880](https://github.com/dotnet/fsharp/pull/19880)) * Emit debug points at a stack-empty position ([PR #19877](https://github.com/dotnet/fsharp/pull/19877)) * Fix spurious XmlDoc warnings (unknown parameter / no documentation for parameter) under `--warnon:3390` when a get/set property documents the full parameter set across both accessors. ([Issue #13684](https://github.com/dotnet/fsharp/issues/13684), [PR #19884](https://github.com/dotnet/fsharp/pull/19884)) +* Fix Go to Metadata rendering of IL literal (`const`) fields - they now appear with `[]` and their constant value, e.g. `System.Char.MaxValue` no longer shows as a plain `static val`. ([Issue #11526](https://github.com/dotnet/fsharp/issues/11526), [PR #19922](https://github.com/dotnet/fsharp/pull/19922)) * FSI multi-assembly emit (`--multiemit+`) now attaches `System.Diagnostics.DebuggableAttribute(DisableOptimizations|Default)` to each submission's manifest when local optimizations are disabled (`--optimize-`), matching the single-emit and regular-compiler behavior so debuggers see submissions as unoptimized. ([Issue #14572](https://github.com/dotnet/fsharp/issues/14572), [PR #19921](https://github.com/dotnet/fsharp/pull/19921)) * Stop F# Interactive from mutating script arguments that follow `--`. Abbreviated flags like `-d`, `-r`, `-I` after the `--` separator are no longer colon-joined with their next token in `fsi.CommandLineArgs`. ([Issue #10819](https://github.com/dotnet/fsharp/issues/10819), [PR #19926](https://github.com/dotnet/fsharp/pull/19926)) * Fix Go-to-Definition for provided constructors that lack `TypeProviderDefinitionLocationAttribute`. Navigation now falls back to the declaring type instead of silently failing. ([Issue #5538](https://github.com/dotnet/fsharp/issues/5538), [PR #19917](https://github.com/dotnet/fsharp/pull/19917)) diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 31fae349f11..91751d5c8e5 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -463,7 +463,8 @@ module PrintIL = let s = d.ToString ("g12", CultureInfo.InvariantCulture) let s = ensureFloat s s |> (tagNumericLiteral >> Some) - | _ -> None + | ILFieldInit.String s -> ("\"" + s + "\"") |> (tagStringLiteral >> Some) + | ILFieldInit.Null -> "null" |> (tagKeyword >> Some) | None -> None match textOpt with | None -> WordL.equals ^^ (comment "value unavailable") @@ -1972,6 +1973,11 @@ module TastDefinitionPrinting = let nameL = ConvertLogicalNameToDisplayLayout (tagField >> wordL) finfo.FieldName let typL = layoutType denv (finfo.FieldType(infoReader.amap, m)) let fieldL = staticL ^^ WordL.keywordVal ^^ (nameL |> addColonL) ^^ typL + let isLiteral = finfo.LiteralValue.IsSome + let fieldL = + if isLiteral then fieldL ^^ PrintIL.layoutILFieldInit finfo.LiteralValue + else fieldL + let fieldL = fieldL |> PrintTypes.layoutAttribs denv None isLiteral TyparKind.Type [] layoutXmlDocOfILFieldInfo denv infoReader finfo fieldL let layoutEventInfo denv (infoReader: InfoReader) m (einfo: EventInfo) = diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index d9a68b3f8c9..e7a1d5f683e 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -1530,6 +1530,78 @@ let test = System.DateTimeKind.Utc failwith "Expected metadata text, got None" | _ -> failwith "Expected FSharpEntity symbol" +module MetadataAsTextILField = + + let private getMetadataTextForEntity (entityName: string) (source: string) : string = + let _, checkResults = getParseAndCheckResults source + let symbolUse = checkResults |> findSymbolUseByName entityName + match symbolUse.Symbol with + | :? FSharpEntity as entity -> + match entity.TryGetMetadataText() with + | Some text -> text.ToString() + | None -> failwithf "Expected metadata text for %s, got None" entityName + | other -> failwithf "Expected FSharpEntity for %s, got %A" entityName other + + [] + [] + [] + [] + [] + [] + let ``IL literal static field renders with [] attribute and value`` + (typeName: string, fieldName: string, expectedValueText: string) = + let source = $"let _ = typeof<{typeName}>" + let shortName = typeName.Substring(typeName.LastIndexOf('.') + 1) + let metadataText = getMetadataTextForEntity shortName source + + Assert.Contains(fieldName, metadataText) + + let line = + metadataText.Split('\n') + |> Array.tryFind (fun l -> l.Contains("val " + fieldName + ":")) + |> Option.defaultWith (fun () -> failwithf "field declaration for %s not found in metadata text:\n%s" fieldName metadataText) + + Assert.Contains("[]", metadataText) + Assert.Contains("= " + expectedValueText, line) + + [] + let ``System.Char.MaxValue renders as a literal field`` () = + let metadataText = getMetadataTextForEntity "Char" "let _ = typeof" + + Assert.Contains("[]", metadataText) + let line = + metadataText.Split('\n') + |> Array.tryFind (fun l -> l.Contains("val MaxValue:")) + |> Option.defaultWith (fun () -> failwithf "MaxValue declaration not found:\n%s" metadataText) + Assert.Contains("=", line) + Assert.False(line.TrimEnd().EndsWith(": char"), + sprintf "MaxValue line is missing its literal value: %s" line) + + [] + let ``IL const string field renders with [] and the quoted string value`` () = + let metadataText = + getMetadataTextForEntity "RuntimeFeature" "let _ = typeof" + + Assert.Contains("[]", metadataText) + let line = + metadataText.Split('\n') + |> Array.tryFind (fun l -> l.Contains("val PortablePdb:")) + |> Option.defaultWith (fun () -> failwithf "PortablePdb declaration not found:\n%s" metadataText) + Assert.Contains("= \"PortablePdb\"", line) + Assert.DoesNotContain("value unavailable", line) + + [] + let ``System.String.Empty (initonly, non-literal) renders without [] and without value`` () = + let metadataText = getMetadataTextForEntity "String" "let _ = typeof" + + let line = + metadataText.Split('\n') + |> Array.tryFind (fun l -> l.Contains("val Empty:")) + |> Option.defaultWith (fun () -> failwithf "Empty not found:\n%s" metadataText) + + Assert.Contains("static val", line) + Assert.DoesNotContain("=", line) + module IsByRef = // https://github.com/dotnet/fsharp/issues/3532 [] From 9f5d8ccf6d5eaa4e7598768c9cabefb7ad4041fb Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 11:09:14 +0200 Subject: [PATCH 03/11] Fix shouldBeParenthesizedInContext for Sequential in record fields (#17826) (#19850) --- .../.FSharp.Compiler.Service/11.0.100.md | 1 + src/Compiler/Service/SynExpr.fs | 5 +++++ tests/FSharp.Compiler.Service.Tests/SynExprTests.fs | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index dcde4f5e785..f4fd04bf0e1 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -103,6 +103,7 @@ * Reference assembly MVIDs are now deterministic across compiler invocations. Previously, `--refout` / `true` produced a different MVID every build because the implied signature hash used .NET's randomized `String.GetHashCode()`. ([Issue #19751](https://github.com/dotnet/fsharp/issues/19751), [PR #19801](https://github.com/dotnet/fsharp/pull/19801)) * Parser: recover on unfinished if and binary expressions ([PR #19724](https://github.com/dotnet/fsharp/pull/19724)) +* Fix `SynExpr.shouldBeParenthesizedInContext` to report parentheses as required around `SynExpr.Sequential` expressions used as record or anonymous-record field values, so the IDE "remove unnecessary parentheses" analyzer no longer breaks code like `{| A = ((); B = 3) |}`. ([Issue #17826](https://github.com/dotnet/fsharp/issues/17826), [PR #19850](https://github.com/dotnet/fsharp/pull/19850)) * Fix semantic classification of `IDisposable` and other interface types in type-occurrence positions being incorrectly classified as `DisposableType` instead of `Interface`. ([Issue #16268](https://github.com/dotnet/fsharp/issues/16268), [PR #19809](https://github.com/dotnet/fsharp/pull/19809)) * Fix missing semantic classification on second and later type qualifiers in nested copy-and-update expressions like `{ p with Person.Info.X = 1; Person.Info.Y = 2 }`. ([Issue #17428](https://github.com/dotnet/fsharp/issues/17428), [PR #19878](https://github.com/dotnet/fsharp/pull/19878)) * Parser: recover on unfinished if and binary expressions ([PR #19724](https://github.com/dotnet/fsharp/pull/19724)) diff --git a/src/Compiler/Service/SynExpr.fs b/src/Compiler/Service/SynExpr.fs index d1d0c6eb4c3..8a81d77193e 100644 --- a/src/Compiler/Service/SynExpr.fs +++ b/src/Compiler/Service/SynExpr.fs @@ -1093,6 +1093,11 @@ module SynExpr = | SynInterpolatedStringPart.FillExpr(qualifiers = Some _) -> true | _ -> false) + // {| A = (1; 2) |} + // { A = (1; 2) } + // Removing the parens would let the semicolon be parsed as a field separator. + | (SynExpr.Record _ | SynExpr.AnonRecd _), SynExpr.Sequential _ -> true + // { (!x) with … } | SynExpr.Record(copyInfo = Some(SynExpr.Paren(expr = Is inner), _)), SynExpr.App(isInfix = false; funcExpr = FuncExpr.SymbolicOperator(StartsWith('!' | '~'))) diff --git a/tests/FSharp.Compiler.Service.Tests/SynExprTests.fs b/tests/FSharp.Compiler.Service.Tests/SynExprTests.fs index 69e85d816b5..8d8a0448902 100644 --- a/tests/FSharp.Compiler.Service.Tests/SynExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/SynExprTests.fs @@ -58,6 +58,17 @@ let exprs: obj array list = } " |] + // https://github.com/dotnet/fsharp/issues/17826 + // Sequential expressions used as record / anonymous record field values + // require their enclosing parentheses - otherwise the semicolon is parsed + // as a field separator. + [|[Needed]; "{| A = (1; 2) |}"|] + [|[Needed]; "{ A = (1; 2) }"|] + [|[Needed]; "{| A = ((); B = 3) |}"|] + [|[Needed]; "{| A = (printfn \"hi\"; 3) |}"|] + [|[Needed]; "{ existing with A = (1; 2) }"|] + [|[Needed; Needed]; "{| A = (1; 2); B = (3; 4) |}"|] + [|[Needed; Unneeded]; "{ Outer = ({ Inner = (1; 2) }) }"|] ] #if !NET6_0_OR_GREATER From a7ee438a44c3da056a9af89d359adab99dcea9ba Mon Sep 17 00:00:00 2001 From: Missy Messa <47990216+missymessa@users.noreply.github.com> Date: Tue, 7 Jul 2026 05:17:25 -0700 Subject: [PATCH 04/11] Migrate devdiv/dotnet-core-internal-tooling to WIF service connection (#20036) Replace PAT-backed externalnugetfeed SC with WIF-based azureDevOpsServiceConnection for the devdiv/dotnet-core-internal-tooling NuGet feed. Part of PAT disable policy migration (WI 10124). New SC: dnceng-devdiv-dotnet-core-internal-tooling-feed-rw-wif --- eng/restore-internal-tools.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/restore-internal-tools.yml b/eng/restore-internal-tools.yml index 01cd835c5b7..6cb82b12780 100644 --- a/eng/restore-internal-tools.yml +++ b/eng/restore-internal-tools.yml @@ -1,7 +1,9 @@ steps: - task: NuGetAuthenticate@1 + displayName: Authenticate devdiv/dotnet-core-internal-tooling feed (WIF) inputs: - nuGetServiceConnections: 'devdiv/dotnet-core-internal-tooling' + azureDevOpsServiceConnection: dnceng-devdiv-dotnet-core-internal-tooling-feed-rw-wif + feedUrl: https://pkgs.dev.azure.com/devdiv/_packaging/dotnet-core-internal-tooling/nuget/v3/index.json forceReinstallCredentialProvider: true - script: $(Build.SourcesDirectory)\eng\RestoreInternal.cmd From 525786372be14e9e4ac83b9154d76df010db5490 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 14:21:51 +0200 Subject: [PATCH 05/11] Make parallel and sequential code generation byte-identical (#19929) --- azure-pipelines-PR.yml | 13 +- .../.FSharp.Compiler.Service/11.0.100.md | 2 + eng/test-determinism.ps1 | 27 +- src/Compiler/CodeGen/IlxGen.fs | 470 +++++++----------- src/Compiler/Optimize/DetupleArgs.fs | 2 +- .../Optimize/InnerLambdasToTopLevelFuncs.fs | 2 +- src/Compiler/Optimize/Optimizer.fs | 42 +- src/Compiler/TypedTree/CompilerGlobalState.fs | 2 - .../TypedTree/CompilerGlobalState.fsi | 1 - .../TypedTreeOps.ExprConstruction.fsi | 1 + tests/AheadOfTime/Trimming/check.ps1 | 11 +- ...ameters.fs.RealInternalSignatureOff.il.bsl | 22 +- ...rameters.fs.RealInternalSignatureOn.il.bsl | 39 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- .../DebugInlineAsCall/Accessibility 11.bsl | 18 +- .../EmittedIL/DebugInlineAsCall/Call 14.bsl | 16 +- .../EmittedIL/DebugInlineAsCall/Call 15.bsl | 14 +- ...cursive inline with different type arg.bsl | 12 +- ...RealInternalSignatureOff.OptimizeOn.il.bsl | 18 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 30 +- ...RealInternalSignatureOff.OptimizeOn.il.bsl | 18 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 30 +- .../Equals10.fsx.il.net472.bsl | 22 +- .../Equals10.fsx.il.netcore.bsl | 22 +- .../Equals11.fsx.il.net472.bsl | 22 +- .../Equals11.fsx.il.netcore.bsl | 22 +- .../Equals12.fsx.il.net472.bsl | 22 +- .../Equals12.fsx.il.netcore.bsl | 22 +- .../Equals13.fsx.il.net472.bsl | 22 +- .../Equals13.fsx.il.netcore.bsl | 22 +- .../Equals14.fsx.il.net472.bsl | 22 +- .../Equals14.fsx.il.netcore.bsl | 22 +- .../Equals15.fsx.il.net472.bsl | 22 +- .../Equals15.fsx.il.netcore.bsl | 22 +- .../Equals16.fsx.il.net472.bsl | 22 +- .../Equals16.fsx.il.netcore.bsl | 22 +- .../Equals17.fsx.il.net472.bsl | 22 +- .../Equals17.fsx.il.netcore.bsl | 22 +- .../Equals18.fsx.il.net472.bsl | 22 +- .../Equals18.fsx.il.netcore.bsl | 22 +- ...eNesting.fs.RealInternalSignatureOn.il.bsl | 24 +- .../EmittedIL/Misc/AnonRecd.fs.il.net472.bsl | 30 +- ...RealInternalSignatureOff.OptimizeOn.il.bsl | 36 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 50 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 16 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 22 +- ...RealInternalSignatureOff.OptimizeOn.il.bsl | 16 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 16 +- .../Nullness/AnonRecords.fs.il.net472.bsl | 16 +- ...ternalSignatureOn.OptimizeOn.il.net472.bsl | 215 ++++---- ...RealInternalSignatureOff.OptimizeOn.il.bsl | 40 +- ....RealInternalSignatureOn.OptimizeOn.il.bsl | 40 +- ...nMethod.fsx.realInternalSignatureOn.il.bsl | 22 +- ...nsions.fsx.realInternalSignatureOff.il.bsl | 16 +- ...ensions.fsx.realInternalSignatureOn.il.bsl | 34 +- ...tension.fsx.realInternalSignatureOn.il.bsl | 22 +- ...edCalls.fsx.realInternalSignatureOn.il.bsl | 22 +- tests/ILVerify/ilverify.ps1 | 4 +- .../CodeGen/EmittedIL/DeterministicTests.fs | 213 ++++++-- 64 files changed, 1083 insertions(+), 1089 deletions(-) diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml index d209acab64e..827b97f33ac 100644 --- a/azure-pipelines-PR.yml +++ b/azure-pipelines-PR.yml @@ -124,17 +124,8 @@ stages: - script: .\eng\common\dotnet.cmd - script: .\eng\test-determinism.cmd -configuration Release displayName: Determinism tests (race detector — same flags both builds) - # Hard gate: any non-determinism between two same-flags Release builds fails CI. - # The single known-racy binary, FSharp.Compiler.Service.dll, is excluded via the - # skipList in eng/test-determinism.ps1 — its residual parallel-optimizer - # newUnique() closure-name race (func2@1-N suffix permutation) is tracked in - # #19928 and fixed by #19929 (always-defer + source-stable closure naming). - # #19810 fixes the structural/heap-order races (#1-7), which are deterministic. - # #19929 removes the skip and restores full coverage once the closure race lands. - # The seq-vs-par leg is intentionally NOT here. It catches a deeper architectural - # issue with parallel optimizer's newUnique() race leaking into closure type names — - # see #19928 / #19929. Same-flags Release-mode determinism (the original #19732 ask) - # fixes the structural races here; the residual closure-name race is fixed in #19929. + - script: .\eng\test-determinism.cmd -configuration Release -mode seq-vs-par + displayName: Determinism tests (1-shot diff — sequential vs parallel) - task: PublishPipelineArtifact@1 displayName: Publish Determinism Logs inputs: diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index f4fd04bf0e1..0552480fb6c 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,5 +1,6 @@ ### Fixed +* `--deterministic` Release builds now produce byte-identical `FSharp.Compiler.Service.dll` under `--parallelcompilation+` and `--parallelcompilation-`, so it is restored to the determinism gate (now also checked sequential-vs-parallel). Code generation runs the same deferred per-file drain in both modes, with type/member/field emit-order keys and generated names derived from the file being emitted rather than thread-scheduling order. ([Issue #19928](https://github.com/dotnet/fsharp/issues/19928), [PR #19929](https://github.com/dotnet/fsharp/pull/19929)) * Fix `[]` silently producing duplicate IL entries (FS0192/FS2014) when applied to a multi-value let-binding (e.g. `let a, b = 1, 2`); now emits FS0755 at type-check time. ([Issue #6131](https://github.com/dotnet/fsharp/issues/6131), [PR #19924](https://github.com/dotnet/fsharp/pull/19924)) * Fix FS3236 when taking the address of an untyped generalized `let` binding (e.g. `let ffff = ValueNone`) passed to an `inref` parameter. ([Issue #19608](https://github.com/dotnet/fsharp/issues/19608), [PR #19948](https://github.com/dotnet/fsharp/pull/19948)) * Fix IntelliSense not suggesting later named arguments after the first one is autocompleted, for methods (including overloaded methods like `Task.Factory.StartNew`). ([Issue #19906](https://github.com/dotnet/fsharp/issues/19906), [PR #19940](https://github.com/dotnet/fsharp/pull/19940)) @@ -23,6 +24,7 @@ * Fix inner mutually-recursive `let rec ... and ...` functions under `--realsig+` not being lifted to top-level static methods (TLR), causing `FSharpFunc` closure allocations and loss of `tail.` opcodes — the large struct-mutual-recursion perf regression reported in [Issue #17607](https://github.com/dotnet/fsharp/issues/17607). ([PR #19882](https://github.com/dotnet/fsharp/pull/19882)) * Fix `TypeLoadException` ("Specialize tried to implicitly override a method with weaker type parameter constraints") and the related CLR crash with constrained inline calls by stripping constraints from closure-class typars in `EraseClosures.convIlxClosureDef`. ([Issue #14492](https://github.com/dotnet/fsharp/issues/14492), [Issue #19075](https://github.com/dotnet/fsharp/issues/19075), [PR #19882](https://github.com/dotnet/fsharp/pull/19882)) * Fix `FieldAccessException` at runtime when the optimizer relocates a read of a `protected` (family) base-class field into a method outside the field's family (e.g. a trivial member inlined into module/startup code under `--optimize+`). Protected (family) IL field access is no longer hoisted out of its declaring family by inlining or method-splitting. ([Issue #19963](https://github.com/dotnet/fsharp/issues/19963), [PR #19964](https://github.com/dotnet/fsharp/pull/19964)) + * Suppress hover/symbol resolution for wildcard `_` patterns inside `member _.…` bodies that incorrectly showed `val _: T` tooltip. ([PR #19760](https://github.com/dotnet/fsharp/pull/19760)) * Report `seq { }` implicit-yield diagnostics and format specifier locations once instead of twice: the classification pass that decides whether the body is a statement or a yielded element no longer double-reports to the sink or diagnostics. ([Issue #16419](https://github.com/dotnet/fsharp/issues/16419), [PR #19791](https://github.com/dotnet/fsharp/pull/19791), [PR #19895](https://github.com/dotnet/fsharp/pull/19895)) * Stabilize codegen order under `--parallelcompilation+` so `--deterministic` Release builds produce byte-identical IL across rebuilds: optimizer Val iteration, IlxGen type/method/field/event emit order, anonymous-record extra-binding drain, and `FileIndex` assignment now follow source position rather than thread-scheduling order. ([Issue #19732](https://github.com/dotnet/fsharp/issues/19732), [PR #19810](https://github.com/dotnet/fsharp/pull/19810)) diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 35e3a3dadb9..1984acc01a7 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -27,17 +27,11 @@ if ($help) { } # List of binary names that should be skipped because they have a known issue that -# makes them non-deterministic. -# -# FSharp.Compiler.Service.dll: closure type names carry a "-N" suffix whose counter is -# allocated in parallel-emit order. The closure 'uniq' values come from a racy -# Interlocked.Increment, so two same-flags parallel builds can allocate the suffixes in a -# different order (e.g. func2@1-23 vs func2@1-17), drifting the #Strings heap layout. -# This is the residual closure-name race tracked by -# https://github.com/dotnet/fsharp/issues/19928 and fixed by #19929 (always-defer + -# source-stable closure naming). Skip this one binary until that fix lands so the gate -# can stay STRICT for every other binary instead of being globally suppressed. -$script:skipList = @("FSharp.Compiler.Service.dll") +# makes them non-deterministic. Empty: the closure type-name race that made +# FSharp.Compiler.Service.dll non-deterministic (#19928) is fixed - closure names now bucket +# by the file being emitted, not by the closure's own (inlined or synthetic) source file - so +# the gate stays STRICT for every binary. +$script:skipList = @() function Run-Build([string]$rootDir, [string]$increment, [string]$additionalFscFlags = "") { $logFileName = $increment @@ -199,13 +193,12 @@ function Test-MapContents($dataMap) { throw "Didn't find the expected count of binaries" } - # Test for some well known binaries. - # NOTE: FSharp.Compiler.Service.dll is intentionally NOT listed here — it is excluded via - # $script:skipList above (known parallel closure-name race, #19928/#19929) so it never enters - # the map. Re-add it here once #19929 removes the skip. FSharp.Core.dll remains as the anchor - # guaranteeing we actually examined real compiler output. + # Test for some well known binaries. FSharp.Compiler.Service.dll is the large multi-file + # output that exercised the closure-name race (#19928); FSharp.Core.dll anchors that we + # actually examined real compiler output. $list = @( - "FSharp.Core.dll") + "FSharp.Core.dll", + "FSharp.Compiler.Service.dll") foreach ($fileName in $list) { $found = $false diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index ff82231e380..986acc7bba6 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -1995,33 +1995,45 @@ let MergePropertyDefs m ilPropertyDefs = ilPropertyDefs |> List.iter (AddPropertyDefToHash m ht) HashRangeSorted ht +[] +type CodegenFileScope private () = + [] + static val mutable private currentFileIdx: int + + static member OrderKey(localIdx: int) : struct (int * int) = + System.Diagnostics.Debug.Assert(CodegenFileScope.currentFileIdx > 0, "OrderKey called outside CodegenFileScope.With") + struct (CodegenFileScope.currentFileIdx, localIdx) + + static member With(fileIdx: int, action: unit -> 'T) : 'T = + let prev = CodegenFileScope.currentFileIdx + + try + CodegenFileScope.currentFileIdx <- fileIdx + action () + finally + CodegenFileScope.currentFileIdx <- prev + //-------------------------------------------------------------------------- // Buffers for compiling modules. The entire assembly gets compiled via an AssemblyBuilder //-------------------------------------------------------------------------- /// Information collected imperatively for each type definition type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = - let mutable methodIdx = 0 - - let gmethods = - let initial = tdef.Methods.AsList() - - let xs = ResizeArray(initial.Length) + let keyed (initial: 'T list) = + let xs = ResizeArray(initial.Length) - for m in initial do - let k = methodIdx - methodIdx <- methodIdx + 1 - xs.Add(struct (m.Name, k), m) + for x in initial do + xs.Add(CodegenFileScope.OrderKey xs.Count, x) xs - let gfields = ResizeArray(tdef.Fields.AsList()) + let gmethods = keyed (tdef.Methods.AsList()) + let gfields = keyed (tdef.Fields.AsList()) + let gevents = keyed (tdef.Events.AsList()) let gproperties: Dictionary = Dictionary<_, _>(3, HashIdentity.Structural) - let gevents = ResizeArray(tdef.Events.AsList()) - let gnested = TypeDefsBuilder() member _.Close(g: TcGlobals) = @@ -2041,45 +2053,23 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = else tdef.CustomAttrs - // Methods come from two sources with different ordering semantics: - // 1. User method definitions added during the sequential spine walk (ctors, - // properties, member bindings). Preserve insertion order for these. - // 2. Deferred-codegen methods (closure invokers with '@' in name) — sort by - // name for deterministic parallel-emit ordering. - let sortedMethods = - let userMethods = ResizeArray() - let deferredMethods = ResizeArray() - - for entry in gmethods do - let struct (name, _) = fst entry - - if name.Contains("@") then - deferredMethods.Add(entry) - else - userMethods.Add(entry) - - let sortedUser = - userMethods - |> Seq.sortBy (fun (struct (_, k), _) -> k) - |> Seq.map snd - |> List.ofSeq - - let sortedDeferred = deferredMethods |> Seq.sortBy fst |> Seq.map snd |> List.ofSeq - - sortedUser @ sortedDeferred + let sortByKey (xs: ResizeArray) = + xs |> Seq.sortBy fst |> Seq.map snd |> List.ofSeq tdef.With( - methods = mkILMethods sortedMethods, - fields = mkILFields (List.ofSeq gfields), + methods = mkILMethods (sortByKey gmethods), + fields = mkILFields (sortByKey gfields), properties = mkILProperties (tdef.Properties.AsList() @ HashRangeSorted gproperties), - events = mkILEvents (List.ofSeq gevents), + events = mkILEvents (sortByKey gevents), nestedTypes = mkILTypeDefs (tdef.NestedTypes.AsList() @ gnested.Close(g)), customAttrs = storeILCustomAttrs attrs ) - member _.AddEventDef(edef: ILEventDef) = gevents.Add(edef) + member _.AddEventDef(edef: ILEventDef) = + gevents.Add(CodegenFileScope.OrderKey gevents.Count, edef) - member _.AddFieldDef(ilFieldDef: ILFieldDef) = gfields.Add(ilFieldDef) + member _.AddFieldDef(ilFieldDef: ILFieldDef) = + gfields.Add(CodegenFileScope.OrderKey gfields.Count, ilFieldDef) member _.AddMethodDef(ilMethodDef: ILMethodDef) = let discard = @@ -2088,9 +2078,7 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = | None -> false if not discard then - let k = methodIdx - methodIdx <- methodIdx + 1 - gmethods.Add(struct (ilMethodDef.Name, k), ilMethodDef) + gmethods.Add(CodegenFileScope.OrderKey gmethods.Count, ilMethodDef) member _.NestedTypeDefs = gnested @@ -2107,34 +2095,23 @@ type TypeDefBuilder(tdef: ILTypeDef, tdefDiscards) = if not discard then AddPropertyDefToHash m gproperties pdef - member _.AppendInstructionsToSpecificMethodDef(cond, instrs, tag, imports) = - match gmethods |> Seq.tryFindIndex (fun (_, md) -> cond md) with + member private this.UpdateOrAddCctor(cond, instrs, tag, imports, transform) = + match ResizeArray.tryFindIndexi (fun _ (_, md) -> cond md) gmethods with | Some idx -> let k, md = gmethods[idx] - gmethods[idx] <- (k, appendInstrsToMethod instrs md) + gmethods[idx] <- (k, transform instrs md) | None -> let body = mkMethodBody (false, [], 1, nonBranchingInstrsToCode instrs, tag, imports) let cctor = mkILClassCtor body - let k = methodIdx - methodIdx <- methodIdx + 1 - gmethods.Add(struct (cctor.Name, k), cctor) - - member this.PrependInstructionsToSpecificMethodDef(cond, instrs, tag, imports) = - match gmethods |> Seq.tryFindIndex (fun (_, md) -> cond md) with - | Some idx -> - let k, md = gmethods[idx] - gmethods[idx] <- (k, prependInstrsToMethod instrs md) - | None -> - let body = - mkMethodBody (false, [], 1, nonBranchingInstrsToCode instrs, tag, imports) + gmethods.Add(CodegenFileScope.OrderKey gmethods.Count, cctor) - let cctor = mkILClassCtor body - let k = methodIdx - methodIdx <- methodIdx + 1 - gmethods.Add(struct (cctor.Name, k), cctor) + member this.AppendInstructionsToSpecificMethodDef(cond, instrs, tag, imports) = + this.UpdateOrAddCctor(cond, instrs, tag, imports, appendInstrsToMethod) + member this.PrependInstructionsToSpecificMethodDef(cond, instrs, tag, imports) = + this.UpdateOrAddCctor(cond, instrs, tag, imports, prependInstrsToMethod) this member _.ILTypeDef = tdef @@ -2475,27 +2452,16 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf // A memoization table for generating value types for big constant arrays // - let primedRawTypeCounter = - ConcurrentDictionary(HashIdentity.Structural) - let rawDataValueTypeGenerator = - MemoizationTable( + MemoizationTable( "rawDataValueTypeGenerator", - (fun (cloc, size) -> - - let unique = - match primedRawTypeCounter.TryGetValue((cloc, size)) with - | true, c -> c - // Prime-miss fallback (e.g. quotation pickle bytes / numeric-literal arrays the source - // prime walk never sees) stays same-flags deterministic: IncrementOnly buckets per - // (name, FileIndex) and the delayed-codegen drain is sequential within a file, so each - // file gets a stable counter. (#19929 removes this counter via content-derived naming.) - | _ -> g.CompilerGlobalState.Value.IlxGenNiceNameGenerator.IncrementOnly("@T", cloc.Range) + (fun (parentRef, size) -> + let name = CompilerGeneratedName $"T_{size}Bytes" + let vtdef = mkRawDataValueTypeDef g.iltyp_ValueType (name, size, 0us) - let name = CompilerGeneratedName $"T{unique}_{size}Bytes" // Type names ending ...$T_37Bytes + let vtref = + mkILNestedTyRef (parentRef.Scope, parentRef.Enclosing @ [ parentRef.Name ], vtdef.Name) - let vtdef = mkRawDataValueTypeDef g.iltyp_ValueType (name, size, 0us) - let vtref = NestedTypeRefForCompLoc cloc vtdef.Name let vtspec = mkILTySpec (vtref, []) let vtdef = @@ -2506,6 +2472,12 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf keyComparer = HashIdentity.Structural ) + let rawDataLineCounters = + ConcurrentDictionary(HashIdentity.Structural) + + let fieldSpecByRange = + ConcurrentDictionary>(HashIdentity.Structural) + let mutable explicitEntryPointInfo: ILTypeRef option = None /// static init fields on script modules. @@ -2545,29 +2517,35 @@ and AssemblyBuilder(cenv: cenv, anonTypeTable: AnonTypeGenerationTable) as mgbuf | None -> () member _.GenerateRawDataValueType(cloc, size) = - // Byte array literals require a ValueType of size the required number of bytes. - // With fsi.exe, S.R.Emit TypeBuilder CreateType has restrictions when a ValueType VT is nested inside a type T, and T has a field of type VT. - // To avoid this situation, these ValueTypes are generated under the private implementation rather than in the current cloc. [was bug 1532]. let cloc = if cenv.options.isInteractive then CompLocForPrivateImplementationDetails cloc else cloc - rawDataValueTypeGenerator.Apply((cloc, size)) + rawDataValueTypeGenerator.Apply((TypeRefForCompLoc cloc, size)) - member _.PrimeRawDataValueTypeCounter(cloc: CompileLocation, size: int) = - let cloc = - if cenv.options.isInteractive then - CompLocForPrivateImplementationDetails cloc - else - cloc + member this.GetOrCreateRawDataFieldSpec(m: range, bytes: byte[], makeFspec: string -> ILFieldSpec) = + // bytesKey is load-bearing: remarkExpr collapses distinct inline arrays to one range, + // so bytes content is the sole discriminator preventing silent field aliasing. + let bytesKey = System.Convert.ToBase64String(bytes) - primedRawTypeCounter.GetOrAdd( - (cloc, size), - (fun _ -> g.CompilerGlobalState.Value.IlxGenNiceNameGenerator.IncrementOnly("@T", cloc.Range)) - ) - |> ignore + let key = + struct (m.FileIndex, m.StartLine, m.StartColumn, m.EndLine, m.EndColumn, bytesKey) + + fieldSpecByRange + .GetOrAdd( + key, + (fun _ -> + lazy + let counterCell = + rawDataLineCounters.GetOrAdd(struct (m.FileIndex, m.StartLine), (fun _ -> ref 0)) + + let idx = System.Threading.Interlocked.Increment(counterCell) + let nameSuffix = sprintf "%d_%d" m.StartLine idx + makeFspec nameSuffix) + ) + .Value member _.GenerateAnonType(genToStringMethod, anonInfo: AnonRecdTypeInfo) = anonTypeTable.GenerateAnonType(cenv, mgbuf, genToStringMethod, anonInfo) @@ -2959,7 +2937,7 @@ module CG = let GenString cenv cgbuf s = CG.EmitInstr cgbuf (pop 0) (Push [ cenv.g.ilg.typ_String ]) (I_ldstr s) -let GenConstArray cenv (cgbuf: CodeGenBuffer) eenv ilElementType (data: 'a[]) (write: ByteBuffer -> 'a -> unit) (_m: range) = +let GenConstArray cenv (cgbuf: CodeGenBuffer) eenv ilElementType (data: 'a[]) (write: ByteBuffer -> 'a -> unit) (m: range) = let g = cenv.g use buf = ByteBuffer.Create data.Length data |> Array.iter (write buf) @@ -2969,23 +2947,26 @@ let GenConstArray cenv (cgbuf: CodeGenBuffer) eenv ilElementType (data: 'a[]) (w if data.Length = 0 then CG.EmitInstrs cgbuf (pop 0) (Push [ ilArrayType ]) [ mkLdcInt32 0; I_newarr(ILArrayShape.SingleDimensional, ilElementType) ] else - let vtspec = cgbuf.mgbuf.GenerateRawDataValueType(eenv.cloc, bytes.Length) + let fspec = + cgbuf.mgbuf.GetOrCreateRawDataFieldSpec( + m, + bytes, + fun unique -> + let vtspec = cgbuf.mgbuf.GenerateRawDataValueType(eenv.cloc, bytes.Length) + let ilFieldName = CompilerGeneratedName $"field{unique}" + let fty = ILType.Value vtspec - let unique = - g.CompilerGlobalState.Value.IlxGenNiceNameGenerator.IncrementOnly("@field", eenv.cloc.Range) - - let ilFieldName = CompilerGeneratedName $"field{unique}" - let fty = ILType.Value vtspec - - let ilFieldDef = - mkILStaticField (ilFieldName, fty, None, Some bytes, ILMemberAccess.Assembly) + let ilFieldDef = + mkILStaticField (ilFieldName, fty, None, Some bytes, ILMemberAccess.Assembly) - let ilFieldDef = - ilFieldDef.With(customAttrs = mkILCustomAttrs [ g.DebuggerBrowsableNeverAttribute ]) + let ilFieldDef = + ilFieldDef.With(customAttrs = mkILCustomAttrs [ g.DebuggerBrowsableNeverAttribute ]) - let fspec = mkILFieldSpecInTy (mkILTyForCompLoc eenv.cloc, ilFieldName, fty) - CountStaticFieldDef() - cgbuf.mgbuf.AddFieldDef(fspec.DeclaringTypeRef, ilFieldDef) + let fspec = mkILFieldSpecInTy (mkILTyForCompLoc eenv.cloc, ilFieldName, fty) + CountStaticFieldDef() + cgbuf.mgbuf.AddFieldDef(fspec.DeclaringTypeRef, ilFieldDef) + fspec + ) CG.EmitInstrs cgbuf @@ -10983,10 +10964,11 @@ and GenModuleBinding cenv (cgbuf: CodeGenBuffer) (qname: QualifiedNameOfFile) la GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenvinner mdef |> ignore - // Only force the whole-file .cctor when the module actually has static fields. - // Forcing it unconditionally adds an eager initialization side effect to modules - // with no static state, which changes static-init ordering and caused runtime - // regressions (FSharpPlus testChoice hang, topinit/eval failures). + // Safe: delayCodeGen=true defers raw-data field additions to the drain phase, + // so SEQ and PAR see the same spine-walk-only fields at this point. + if not eenv.delayCodeGen then + invalidOp "HasFields predicate requires delayCodeGen=true for SEQ=PAR safety" + if cgbuf.mgbuf.HasFields(tref) then GenForceWholeFileInitializationAsPartOfCCtor cenv cgbuf.mgbuf lazyInitInfo tref eenv.imports mspec.Range @@ -12696,7 +12678,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = mgbuf.AddTypeDef(tref, tdef, false, false, None, m) Some tref -let PrimeStableNamesForCodegen (cenv: cenv) (mgbuf: AssemblyBuilder) (implFiles: CheckedImplFileAfterOptimization list) = +let PrimeStableNamesForCodegen (cenv: cenv) (implFiles: CheckedImplFileAfterOptimization list) = let g = cenv.g match g.CompilerGlobalState with @@ -12711,199 +12693,93 @@ let PrimeStableNamesForCodegen (cenv: cenv) (mgbuf: AssemblyBuilder) (implFiles: then v.CompiledName g.CompilerGlobalState |> ignore - let stackGuard = StackGuard("PrimeStableNamesForCodegen") - - let rec walkExpr (letBoundVars: ValRef list) (cloc: CompileLocation) (expr: Expr) = - stackGuard.Guard - <| fun () -> - match stripDebugPoints expr with - | Expr.Const _ - | Expr.Val _ - | Expr.WitnessArg _ -> () - - | Expr.Lambda(_, _, _, _, body, _, _) -> walkExpr letBoundVars cloc body - - | Expr.TyLambda(_, _, body, _, _) -> walkExpr letBoundVars cloc body - - | Expr.Obj(_, _, _, basecall, overrides, iimpls, _) -> - walkExpr letBoundVars cloc basecall - - for TObjExprMethod(_, _, _, _, e, _) in overrides do - walkExpr letBoundVars cloc e - - for _, ims in iimpls do - for TObjExprMethod(_, _, _, _, e, _) in ims do - walkExpr letBoundVars cloc e - - | Expr.Let(TBind(v, rhs, _), body, _, _) -> - walkExpr (mkLocalValRef v :: letBoundVars) cloc rhs - walkExpr (mkLocalValRef v :: letBoundVars) cloc body - - | Expr.LetRec(binds, body, _, _) -> - let lbvs = - (binds |> List.map (fun (TBind(v, _, _)) -> mkLocalValRef v)) @ letBoundVars - - for TBind(_, rhs, _) in binds do - walkExpr lbvs cloc rhs - - walkExpr lbvs cloc body - - | Expr.Op(op, _, args, _m) -> - match op with - | TOp.Bytes bytes when cenv.options.emitConstantArraysUsingStaticDataBlobs -> - mgbuf.PrimeRawDataValueTypeCounter(cloc, bytes.Length) - | TOp.UInt16s arr when cenv.options.emitConstantArraysUsingStaticDataBlobs -> - mgbuf.PrimeRawDataValueTypeCounter(cloc, arr.Length * 2) - | _ -> () - - for a in args do - walkExpr letBoundVars cloc a - - | Expr.App(f, _, _, args, _) -> - walkExpr letBoundVars cloc f - - for a in args do - walkExpr letBoundVars cloc a - - | Expr.Sequential(e1, e2, _, _) -> - walkExpr letBoundVars cloc e1 - walkExpr letBoundVars cloc e2 - - | Expr.Match(_, _, dt, targets, _, _) -> - walkDtree letBoundVars cloc dt - - for TTarget(_, body, _) in targets do - walkExpr letBoundVars cloc body - - | Expr.StaticOptimization(_, e2, e3, _) -> - walkExpr letBoundVars cloc e2 - walkExpr letBoundVars cloc e3 - - | Expr.TyChoose(_, body, _) -> walkExpr letBoundVars cloc body - - | Expr.Quote(e, _, _, _, _) -> walkExpr letBoundVars cloc e - - | Expr.Link r -> walkExpr letBoundVars cloc r.Value - - | Expr.DebugPoint(_, inner) -> walkExpr letBoundVars cloc inner - - and walkDtree (letBoundVars: ValRef list) cloc dt = - match dt with - | TDBind(TBind(v, rhs, _), rest) -> - walkExpr (mkLocalValRef v :: letBoundVars) cloc rhs - walkDtree letBoundVars cloc rest - | TDSuccess(args, _) -> - for a in args do - walkExpr letBoundVars cloc a - | TDSwitch(test, cases, dflt, _) -> - walkExpr letBoundVars cloc test - - for TCase(_, sub) in cases do - walkDtree letBoundVars cloc sub - - match dflt with - | Some d -> walkDtree letBoundVars cloc d - | None -> () - - let walkTopBindRhs (v: Val) (rhs: Expr) (cloc: CompileLocation) = - let rec stripOuterTopLambdas (e: Expr) = - match e with - | Expr.TyLambda(_, _, body, _, _) -> stripOuterTopLambdas body - | Expr.Lambda(_, ctorThisValOpt, baseValOpt, _, body, _, _) when Option.isNone ctorThisValOpt && Option.isNone baseValOpt -> - stripOuterTopLambdas body - | _ -> e - - if v.IsCompiledAsTopLevel then - walkExpr [ mkLocalValRef v ] cloc (stripOuterTopLambdas rhs) - else - walkExpr [ mkLocalValRef v ] cloc rhs - - let rec walkModuleContents (cloc: CompileLocation) (x: ModuleOrNamespaceContents) = - match x with - | TMDefRec(_, _, _, mbinds, _) -> - for mb in mbinds do - walkModuleBinding cloc mb - | TMDefLet(TBind(v, rhs, _), _) -> - primeVal v - walkTopBindRhs v rhs cloc - | TMDefDo(e, _) -> walkExpr [] cloc e - | TMDefOpens _ -> () - | TMDefs defs -> - for d in defs do - walkModuleContents cloc d - - and walkModuleBinding (cloc: CompileLocation) (mb: ModuleOrNamespaceBinding) = - match mb with - | ModuleOrNamespaceBinding.Binding(TBind(v, rhs, _)) -> - primeVal v - walkTopBindRhs v rhs cloc - | ModuleOrNamespaceBinding.Module(mspec, mdef) -> - let cloc' = - if mspec.IsNamespace then - cloc - else - CompLocForFixedModule cloc.QualifiedNameOfFile cloc.TopImplQualifiedName mspec - - walkModuleContents cloc' mdef - - let fragCloc = CompLocForFragment cenv.options.fragName cenv.viewCcu + let primingFolder = + { ExprFolder0 with + valBindingSiteIntercept = + fun () (_, v) -> + primeVal v + () + } for implFile in implFiles do - let (CheckedImplFile(qname, _, contents, _, _, _, _)) = implFile.ImplFile - - let fileCloc = - { fragCloc with - TopImplQualifiedName = qname.Text - Range = qname.Range - } - - let initCloc = CompLocForInitClass fileCloc - walkModuleContents initCloc contents + FoldImplFile primingFolder () implFile.ImplFile |> ignore let CodegenAssembly cenv eenv mgbuf implFiles = match List.tryFrontAndBack implFiles with | None -> () | Some(firstImplFiles, lastImplFile) -> - PrimeStableNamesForCodegen cenv mgbuf implFiles + PrimeStableNamesForCodegen cenv implFiles + + // Per-file CodegenFileScope indices are 1-based: firstImplFiles get 1..k, lastImplFile gets k+1, + // and the trailing residue drain gets k+2 (one past the last real file). + let lastImplFileIdx = List.length firstImplFiles + 1 + let residueFileIdx = lastImplFileIdx + 1 + + let eenv, _ = + firstImplFiles + |> List.fold + (fun (eenv, fileIdx) implFile -> + let eenv' = + CodegenFileScope.With(fileIdx, fun () -> GenImplFile cenv mgbuf None eenv implFile) + + eenv', fileIdx + 1) + (eenv, 1) + + let eenv = + CodegenFileScope.With(lastImplFileIdx, fun () -> GenImplFile cenv mgbuf cenv.options.mainMethodInfo eenv lastImplFile) + + let runBatch (fileIdx, genMeths) = + CodegenFileScope.With(fileIdx + 1, fun () -> genMeths |> Array.iter (fun gen -> gen ())) - let eenv = List.fold (GenImplFile cenv mgbuf None) eenv firstImplFiles - let eenv = GenImplFile cenv mgbuf cenv.options.mainMethodInfo eenv lastImplFile + let batches = + eenv.delayedFileGenReverse |> Array.ofList |> Array.rev |> Array.indexed - eenv.delayedFileGenReverse - |> Array.ofList - |> Array.rev - |> ArrayParallel.iter (fun genMeths -> genMeths |> Array.iter (fun gen -> gen ())) + if cenv.options.parallelIlxGenEnabled then + batches |> ArrayParallel.iter runBatch + else + batches |> Array.iter runBatch - // Some constructs generate residue types and bindings. Generate these now. They don't result in any - // top-level initialization code. + // Some constructs generate residue types and bindings (e.g. anon-record structural-equality + // augmentations). Generate these now in a trailing file scope past the last real file index so any + // members/closures they emit still key by a positive currentFileIdx: this preserves the OrderKey + // Debug.Assert(currentFileIdx > 0) invariant and keeps them from being hoisted ahead of real + // members via a struct(0, _) key. They don't result in any top-level initialization code. let extraBindings = mgbuf.GrabExtraBindingsToGenerate() //printfn "#extraBindings = %d" extraBindings.Length if extraBindings.Length > 0 then - let mexpr = TMDefs [ for b in extraBindings -> TMDefLet(b, range0) ] + CodegenFileScope.With( + residueFileIdx, + fun () -> + let mexpr = TMDefs [ for b in extraBindings -> TMDefLet(b, range0) ] - let _emptyTopInstrs, _emptyTopCode = - CodeGenMethod - cenv - mgbuf - ([], - "unused", - eenv, - 0, - None, - (fun cgbuf eenv -> - let lazyInitInfo = ResizeArray() - let qname = QualifiedNameOfFile(mkSynId range0 "unused") - - LocalScope "module" cgbuf (fun (_, endMark) -> - let eenv = - AddBindingsForModuleOrNamespaceContents (AllocValReprWithinExpr cenv cgbuf endMark) eenv.cloc eenv mexpr - - let _eenvEnv = GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenv mexpr - ())), - range0) - //printfn "#_emptyTopInstrs = %d" _emptyTopInstrs.Length - () + let _emptyTopInstrs, _emptyTopCode = + CodeGenMethod + cenv + mgbuf + ([], + "unused", + eenv, + 0, + None, + (fun cgbuf eenv -> + let lazyInitInfo = ResizeArray() + let qname = QualifiedNameOfFile(mkSynId range0 "unused") + + LocalScope "module" cgbuf (fun (_, endMark) -> + let eenv = + AddBindingsForModuleOrNamespaceContents + (AllocValReprWithinExpr cenv cgbuf endMark) + eenv.cloc + eenv + mexpr + + let _eenvEnv = GenModuleOrNamespaceContents cenv cgbuf qname lazyInitInfo eenv mexpr + ())), + range0) + //printfn "#_emptyTopInstrs = %d" _emptyTopInstrs.Length + () + ) mgbuf.AddInitializeScriptsInOrderToEntryPoint(eenv.imports) @@ -13006,7 +12882,7 @@ let GenerateCode (cenv, anonTypeTable, eenv, CheckedAssemblyAfterOptimization im { eenv with cloc = fragLoc moduleCloc = fragLoc - delayCodeGen = cenv.options.parallelIlxGenEnabled + delayCodeGen = true } // Generate the PrivateImplementationDetails type diff --git a/src/Compiler/Optimize/DetupleArgs.fs b/src/Compiler/Optimize/DetupleArgs.fs index 360bf6a22bd..faa83b4b016 100644 --- a/src/Compiler/Optimize/DetupleArgs.fs +++ b/src/Compiler/Optimize/DetupleArgs.fs @@ -704,7 +704,7 @@ let determineTransforms (scope: PerFileNamingScope) g (z: Results) = let vtransforms = Zmap.toList z.Uses - |> List.sortWith (fun (v1, _) (v2, _) -> compare (valSourceOrderKey v1) (valSourceOrderKey v2)) + |> List.sortBy (fst >> valSourceOrderKey) |> List.choose (fun (f, sites) -> selectTransform f sites) let vtransforms = Zmap.ofList valOrder vtransforms vtransforms diff --git a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs index 76e1f443d13..24174f11a45 100644 --- a/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs +++ b/src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs @@ -881,7 +881,7 @@ let CreateNewValuesForTLR (scope: PerFileNamingScope) g tlrS arityM fclassM envP let fs = Zset.elements tlrS - |> List.sortWith (fun v1 v2 -> compare (valSourceOrderKey v1) (valSourceOrderKey v2)) + |> List.sortBy valSourceOrderKey let ffHats = List.map (fun f -> f, createFHat f) fs let fHatM = Zmap.ofList valOrder ffHats fHatM diff --git a/src/Compiler/Optimize/Optimizer.fs b/src/Compiler/Optimize/Optimizer.fs index f67072c1c78..4748685287d 100644 --- a/src/Compiler/Optimize/Optimizer.fs +++ b/src/Compiler/Optimize/Optimizer.fs @@ -4692,26 +4692,34 @@ and p_ValInfo (v: ValInfo) st = p_ExprValueInfo v.ValExprInfo st p_bool v.ValMakesNoCriticalTailcalls st -and p_ModuleInfo x st = +and p_ModuleInfo x st = + // Stamp tiebreaker is safe: every Val reaching ValInfos.Entries has its stamp + // assigned during single-threaded type-checking. + let stableValKey (vref: ValRef) = + let k = vref.Deref.GetLinkageFullKey() + + struct ( + vref.LogicalName, + k.PartialKey.MemberParentMangledName, + k.PartialKey.TotalArgCount, + k.PartialKey.MemberIsOverride, + vref.Deref.Stamp + ) + + let mergeRacedFlags (vref: ValRef, vinfo: ValInfo) = + let merged = vinfo.ValMakesNoCriticalTailcalls || vref.Deref.MakesNoCriticalTailcalls + + if merged = vinfo.ValMakesNoCriticalTailcalls then + vref, vinfo + else + vref, { vinfo with ValMakesNoCriticalTailcalls = merged } + let entries = x.ValInfos.Entries |> Seq.toArray - |> Array.sortBy (fun (vref: ValRef, _) -> - let k = vref.Deref.GetLinkageFullKey() - - struct ( - vref.LogicalName, - k.PartialKey.MemberParentMangledName, - k.PartialKey.TotalArgCount, - k.PartialKey.MemberIsOverride, - vref.Deref.Stamp - )) - |> Array.map (fun (vref, vinfo) -> - let merged = vinfo.ValMakesNoCriticalTailcalls || vref.Deref.MakesNoCriticalTailcalls - if merged = vinfo.ValMakesNoCriticalTailcalls then - vref, vinfo - else - vref, { vinfo with ValMakesNoCriticalTailcalls = merged }) + |> Array.sortBy (fst >> stableValKey) + |> Array.map mergeRacedFlags + p_array (p_tup2 (p_vref "opttab") p_ValInfo) entries st p_namemap p_LazyModuleInfo x.ModuleOrNamespaceInfos st diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fs b/src/Compiler/TypedTree/CompilerGlobalState.fs index d658920787a..dfc8bb0abbe 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fs +++ b/src/Compiler/TypedTree/CompilerGlobalState.fs @@ -40,8 +40,6 @@ type NiceNameGenerator() = member this.FreshCompilerGeneratedName (name, m: range) = this.FreshCompilerGeneratedNameOfBasicName (GetBasicNameOfPossibleCompilerGeneratedName name, m) - member _.IncrementOnly(name: string, m: range) = increment name m - member _.FreshCompilerGeneratedNameInScope (scopeFileIndex: int, name: string, m: range) = let basicName = GetBasicNameOfPossibleCompilerGeneratedName name let count = incrementBucket basicName scopeFileIndex diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fsi b/src/Compiler/TypedTree/CompilerGlobalState.fsi index 91689196ade..cf357d066be 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fsi +++ b/src/Compiler/TypedTree/CompilerGlobalState.fsi @@ -17,7 +17,6 @@ type NiceNameGenerator = new: unit -> NiceNameGenerator member FreshCompilerGeneratedName: name: string * m: range -> string - member IncrementOnly: name: string * m: range -> int /// Generates compiler-generated names marked up with a source code location, but if given the same unique value then /// return precisely the same name. Each name generated also includes the StartLine number of the range passed in diff --git a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fsi b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fsi index 53be76e3cdc..de866c4175d 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.ExprConstruction.fsi @@ -22,6 +22,7 @@ module internal ExprConstruction = /// An ordering for value definitions, based on stamp val valOrder: IComparer + /// Stable, source-position-derived key for ordering Vals. val valSourceOrderKey: Val -> struct (int * int * int * string) /// An ordering for type definitions, based on stamp diff --git a/tests/AheadOfTime/Trimming/check.ps1 b/tests/AheadOfTime/Trimming/check.ps1 index f6fcf7a591b..49cf96e31d3 100644 --- a/tests/AheadOfTime/Trimming/check.ps1 +++ b/tests/AheadOfTime/Trimming/check.ps1 @@ -62,17 +62,16 @@ function CheckTrim($root, $tfm, $outputfile, $expected_len, $callerLineNumber) { $allErrors = @() -# Check net9.0 trimmed assemblies +# Check net9.0 trimmed assemblies. $allErrors += CheckTrim -root "SelfContained_Trimming_Test" -tfm "net9.0" -outputfile "FSharp.Core.dll" -expected_len 311296 -callerLineNumber 66 # Check net9.0 trimmed assemblies with static linked FSharpCore. -# Placeholder (-1): this app statically links FSharp.Compiler.Service, whose size still -# varies with the parallel-optimizer closure-name residual (#19928, fixed by #19929) and -# the local-vs-CI trimmer toolchain. Pin a real size once #19929 lands. -$allErrors += CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len -1 -callerLineNumber 69 +# Statically links FSharp.Compiler.Service; the size is stable now that its codegen is +# deterministic (#19928/#19929). Update if compiler/trimming output intentionally changes. +$allErrors += CheckTrim -root "StaticLinkedFSharpCore_Trimming_Test" -tfm "net9.0" -outputfile "StaticLinkedFSharpCore_Trimming_Test.dll" -expected_len 9173504 -callerLineNumber 71 # Check net9.0 trimmed assemblies with F# metadata resources removed -$allErrors += CheckTrim -root "FSharpMetadataResource_Trimming_Test" -tfm "net9.0" -outputfile "FSharpMetadataResource_Trimming_Test.dll" -expected_len 7612928 -callerLineNumber 72 +$allErrors += CheckTrim -root "FSharpMetadataResource_Trimming_Test" -tfm "net9.0" -outputfile "FSharpMetadataResource_Trimming_Test.dll" -expected_len 7612928 -callerLineNumber 74 # Report all errors and exit with failure if any occurred if ($allErrors.Count -gt 0) { diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl index 1683f66f50e..ab736a3c457 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOff.il.bsl @@ -50,28 +50,29 @@ } - .method assembly specialname static int32 get_outArg@8() cil managed + .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$OutOptionalTests::outArg@8 + IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@8 IL_0005: ret } - .method assembly specialname static int32 'get_outArg@9-1'() cil managed + .method assembly specialname static int32 get_outArg@8() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$OutOptionalTests::'outArg@9-1' + IL_0000: ldsfld int32 ''.$OutOptionalTests::outArg@8 IL_0005: ret } - .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed + .method assembly specialname static void set_outArg@8(int32 'value') cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 ''.$OutOptionalTests::patternInput@8 - IL_0005: ret + IL_0000: ldarg.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@8 + IL_0006: ret } .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@9-1'() cil managed @@ -82,13 +83,12 @@ IL_0005: ret } - .method assembly specialname static void set_outArg@8(int32 'value') cil managed + .method assembly specialname static int32 'get_outArg@9-1'() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::outArg@8 - IL_0006: ret + IL_0000: ldsfld int32 ''.$OutOptionalTests::'outArg@9-1' + IL_0005: ret } .method assembly specialname static void 'set_outArg@9-1'(int32 'value') cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl index ccdd1726cac..320273baa2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/MethodResolution/OptionalAndOutParameters.fs.RealInternalSignatureOn.il.bsl @@ -58,15 +58,12 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly int32 'outArg@9-1' .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed + .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$OutOptionalTests::init@ - IL_0006: ldsfld int32 ''.$OutOptionalTests::init@ - IL_000b: pop - IL_000c: ret + IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@8 + IL_0005: ret } .method assembly specialname static int32 get_outArg@8() cil managed @@ -77,46 +74,49 @@ IL_0005: ret } - .method assembly specialname static int32 'get_outArg@9-1'() cil managed + .method assembly specialname static void set_outArg@8(int32 'value') cil managed { .maxstack 8 - IL_0000: ldsfld int32 OutOptionalTests::'outArg@9-1' - IL_0005: ret + IL_0000: ldarg.0 + IL_0001: stsfld int32 OutOptionalTests::outArg@8 + IL_0006: ret } - .method assembly specialname static class [runtime]System.Tuple`2 get_patternInput@8() cil managed + .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@9-1'() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::patternInput@8 + IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@9-1' IL_0005: ret } - .method assembly specialname static class [runtime]System.Tuple`2 'get_patternInput@9-1'() cil managed + .method assembly specialname static int32 'get_outArg@9-1'() cil managed { .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`2 OutOptionalTests::'patternInput@9-1' + IL_0000: ldsfld int32 OutOptionalTests::'outArg@9-1' IL_0005: ret } - .method assembly specialname static void set_outArg@8(int32 'value') cil managed + .method assembly specialname static void 'set_outArg@9-1'(int32 'value') cil managed { .maxstack 8 IL_0000: ldarg.0 - IL_0001: stsfld int32 OutOptionalTests::outArg@8 + IL_0001: stsfld int32 OutOptionalTests::'outArg@9-1' IL_0006: ret } - .method assembly specialname static void 'set_outArg@9-1'(int32 'value') cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld int32 OutOptionalTests::'outArg@9-1' - IL_0006: ret + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$OutOptionalTests::init@ + IL_0006: ldsfld int32 ''.$OutOptionalTests::init@ + IL_000b: pop + IL_000c: ret } .method assembly static void staticInitialization@() cil managed @@ -198,3 +198,4 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 6d7bb25f2c0..bf8d61c2c81 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest1.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -118,17 +118,6 @@ IL_0011: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -145,6 +134,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index f30163e4e6e..db8466927b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest2.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -180,17 +180,6 @@ IL_0019: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -207,6 +196,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 0bf0bc68cf7..3fd6bffac1f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest3.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -149,17 +149,6 @@ IL_0011: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -176,6 +165,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index b09bee355e6..d6e821f237c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest4.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -280,17 +280,6 @@ IL_0011: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -307,6 +296,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index f6eab7c7c48..f026a2496bd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest5.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -345,17 +345,6 @@ IL_0011: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -372,6 +361,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 82a74f660af..15cf80f9313 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/AsyncExpressionStepping/AsyncExpressionSteppingTest6.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -607,17 +607,6 @@ IL_0011: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1 get_arg@1() cil managed { @@ -634,6 +623,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Accessibility 11.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Accessibility 11.bsl index 539f2942ff6..7bc7054a65f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Accessibility 11.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Accessibility 11.bsl @@ -78,6 +78,15 @@ T::.cctor IL_000b: pop IL_000c: ret +T::staticInitialization@ + (5,12-5,21) let i = 1 + IL_0000: ldc.i4.1 + IL_0001: stsfld T::i + IL_0006: ldc.i4.1 + IL_0007: volatile. + IL_0009: stsfld T::init@4 + IL_000e: ret + T::__debug@7 (6,58-6,59) i IL_0000: volatile. @@ -97,12 +106,3 @@ T::__debug@7 IL_0013: nop IL_0014: ldsfld T::i IL_0019: ret - -T::staticInitialization@ - (5,12-5,21) let i = 1 - IL_0000: ldc.i4.1 - IL_0001: stsfld T::i - IL_0006: ldc.i4.1 - IL_0007: volatile. - IL_0009: stsfld T::init@4 - IL_000e: ret diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 14.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 14.bsl index e1fd2983ee7..38f4791daf0 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 14.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 14.bsl @@ -33,14 +33,6 @@ Test::g$W IL_000d: add IL_000e: ret -Test::.cctor - - IL_0000: ldc.i4.0 - IL_0001: stsfld $Test::init@ - IL_0006: ldsfld $Test::init@ - IL_000b: pop - IL_000c: ret - Test::__debug@7 (5,32-5,41) f (x + y) IL_0000: ldarg.0 @@ -50,6 +42,14 @@ Test::__debug@7 IL_0004: add IL_0005: ret +Test::.cctor + + IL_0000: ldc.i4.0 + IL_0001: stsfld $Test::init@ + IL_0006: ldsfld $Test::init@ + IL_000b: pop + IL_000c: ret + Test::staticInitialization@ (7,1-7,6) g 1 2 IL_0000: ldc.i4.1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 15.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 15.bsl index 383930edbe7..3b60f224c31 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 15.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/Call 15.bsl @@ -31,6 +31,13 @@ Test::g$W IL_0009: call InvokeFast IL_000e: ret +Test::__debug@7 + (5,32-5,41) f (x + y) + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: add + IL_0003: ret + Test::.cctor IL_0000: ldc.i4.0 @@ -39,13 +46,6 @@ Test::.cctor IL_000b: pop IL_000c: ret -Test::__debug@7 - (5,32-5,41) f (x + y) - IL_0000: ldarg.0 - IL_0001: ldarg.1 - IL_0002: add - IL_0003: ret - Test::staticInitialization@ (7,1-7,6) g 1 2 IL_0000: ldc.i4.1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/SRTP 22 - Recursive inline with different type arg.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/SRTP 22 - Recursive inline with different type arg.bsl index 2c90e1376e9..22632af1c65 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/SRTP 22 - Recursive inline with different type arg.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DebugInlineAsCall/SRTP 22 - Recursive inline with different type arg.bsl @@ -63,22 +63,22 @@ Test::main IL_0015: ldc.i4.1 IL_0016: ret -Test::__debug@13 +Test::__debug@9-1 (6,36-6,69) (T $ Unchecked.defaultof<'r>) i x IL_0000: call T::get_T - IL_0005: ldnull - IL_0006: call Test::__debug@6 + IL_0005: ldc.i4.0 + IL_0006: call T::op_Dollar IL_000b: ldarg.0 IL_000c: ldarg.1 IL_000d: tail. IL_000f: call InvokeFast IL_0014: ret -Test::__debug@9-1 +Test::__debug@13 (6,36-6,69) (T $ Unchecked.defaultof<'r>) i x IL_0000: call T::get_T - IL_0005: ldc.i4.0 - IL_0006: call T::op_Dollar + IL_0005: ldnull + IL_0006: call Test::__debug@6 IL_000b: ldarg.0 IL_000c: ldarg.1 IL_000d: tail. diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.OptimizeOn.il.bsl index f36dd09ddc2..45d30e4a1c6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOff.OptimizeOn.il.bsl @@ -57,6 +57,15 @@ IL_0005: ret } + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 + IL_0006: ret + } + .method assembly specialname static int32 get_e1@1() cil managed { @@ -81,15 +90,6 @@ IL_0005: ret } - .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 - IL_0006: ret - } - .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 9c4aabc28ab..9f4931ff9f7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd03.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -61,23 +61,21 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0005: ret + IL_0000: ldarg.0 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0006: ret } .method assembly specialname static int32 get_e1@1() cil managed @@ -104,22 +102,24 @@ IL_0005: ret } - .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 IL_0006: ret } - .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0006: ret + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret } .method assembly static void staticInitialization@() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.OptimizeOn.il.bsl index 894f3c82c64..78bc9fe4342 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOff.OptimizeOn.il.bsl @@ -57,6 +57,15 @@ IL_0005: ret } + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 + IL_0006: ret + } + .method assembly specialname static int32 get_e1@1() cil managed { @@ -81,15 +90,6 @@ IL_0005: ret } - .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 ''.$assembly::current@9 - IL_0006: ret - } - .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index e5f244aa9c5..e9ee8964726 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NonTrivialBranchingBindingInEnd04.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -61,23 +61,21 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0005: ret + IL_0000: ldarg.0 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0006: ret } .method assembly specialname static int32 get_e1@1() cil managed @@ -104,22 +102,24 @@ IL_0005: ret } - .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 IL_0006: ret } - .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldarg.0 - IL_0001: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0006: ret + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret } .method assembly static void staticInitialization@() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl index b477f2b4bbd..1d15587c215 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.net472.bsl @@ -357,17 +357,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -392,6 +381,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl index b477f2b4bbd..1d15587c215 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals10.fsx.il.netcore.bsl @@ -357,17 +357,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -392,6 +381,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl index cd28d924687..abaef1b1e97 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.net472.bsl @@ -447,17 +447,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -482,6 +471,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl index 04815c3b085..00bdf966b88 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals11.fsx.il.netcore.bsl @@ -447,17 +447,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -482,6 +471,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl index 35dabf683a1..526f62b1351 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.net472.bsl @@ -391,17 +391,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -426,6 +415,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl index 05bef0acdff..3417bbfd3bc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals12.fsx.il.netcore.bsl @@ -391,17 +391,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -426,6 +415,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl index 83c1fd826cf..8daa2678cb6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.net472.bsl @@ -383,17 +383,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericStruct`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -418,6 +407,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl index 83c1fd826cf..8daa2678cb6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals13.fsx.il.netcore.bsl @@ -383,17 +383,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericStruct`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -418,6 +407,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl index cd307b9c5e0..c8d6dbb2dfd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.net472.bsl @@ -473,17 +473,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericUnion`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -508,6 +497,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl index cf8480c58d1..541e25c5210 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals14.fsx.il.netcore.bsl @@ -473,17 +473,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericUnion`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -508,6 +497,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl index fa25aa1ed62..33d45fc8bbd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.net472.bsl @@ -417,17 +417,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericRecord`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -452,6 +441,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl index a30b4b70858..38b3610d0c2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals15.fsx.il.netcore.bsl @@ -417,17 +417,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeGenericRecord`1 y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -452,6 +441,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl index 3e84fe0b1a5..4d34d84ee61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.net472.bsl @@ -357,17 +357,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -392,6 +381,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl index 3e84fe0b1a5..4d34d84ee61 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals16.fsx.il.netcore.bsl @@ -357,17 +357,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeStruct y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -392,6 +381,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl index bdc06c093a2..28852e8defc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.net472.bsl @@ -447,17 +447,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -482,6 +471,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl index c09916f96f8..3004404175c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals17.fsx.il.netcore.bsl @@ -447,17 +447,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeUnion y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -482,6 +471,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl index ddf69384863..cbcf2f71bad 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.net472.bsl @@ -391,17 +391,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -426,6 +415,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl index 692d6c3c424..a40baefd7b8 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals18.fsx.il.netcore.bsl @@ -391,17 +391,6 @@ .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .field static assembly valuetype assembly/EqualsMicroPerfAndCodeGenerationTests/SomeRecord y@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_arg@1() cil managed { @@ -426,6 +415,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/AugmentationClosureNesting.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/AugmentationClosureNesting.fs.RealInternalSignatureOn.il.bsl index 2e61311286a..04b8d498e76 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/AugmentationClosureNesting.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/AugmentationClosureNesting.fs.RealInternalSignatureOn.il.bsl @@ -146,6 +146,18 @@ IL_000c: ret } + .method assembly static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 Sample/C::backing + IL_0006: ldc.i4.1 + IL_0007: volatile. + IL_0009: stsfld int32 Sample/C::init@2 + IL_000e: ret + } + .method public hidebysig instance int32 Run() cil managed { @@ -160,18 +172,6 @@ IL_000f: ret } - .method assembly static void staticInitialization@() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 Sample/C::backing - IL_0006: ldc.i4.1 - IL_0007: volatile. - IL_0009: stsfld int32 Sample/C::init@2 - IL_000e: ret - } - } .method public static int32 main(string[] _arg1) cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl index af11ac26847..50435594d2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/AnonRecd.fs.il.net472.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -90,9 +80,7 @@ .field private !'j__TPar' B@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(!'j__TPar' A, - !'j__TPar' B) cil managed + .method public specialname rtspecialname instance void .ctor(!'j__TPar' A, !'j__TPar' B) cil managed { .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, class [runtime]System.Type) = ( 01 00 60 06 00 00 1E 3C 3E 66 5F 5F 41 6E 6F 6E @@ -218,9 +206,7 @@ IL_000e: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -350,9 +336,7 @@ IL_000d: ret } - .method public hidebysig instance bool - Equals(class '<>f__AnonymousType1912756633`2'j__TPar',!'j__TPar'> obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(class '<>f__AnonymousType1912756633`2'j__TPar',!'j__TPar'> obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -401,9 +385,7 @@ IL_003c: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -540,9 +522,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl index 3ec0bb3490d..deb49d2adb1 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl @@ -291,75 +291,75 @@ IL_0005: ret } - .method assembly specialname static int32 'get_arg_0@34-1'() cil managed + .method assembly specialname static int32 get_arg_1@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_0@34-1' + IL_0000: ldsfld int32 ''.$assembly::arg_1@30 IL_0005: ret } - .method assembly specialname static int32 'get_arg_0@38-2'() cil managed + .method assembly specialname static int32 get_arg_2@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_0@38-2' + IL_0000: ldsfld int32 ''.$assembly::arg_2@30 IL_0005: ret } - .method assembly specialname static int32 get_arg_1@30() cil managed + .method assembly specialname static int32 get_arg_3@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::arg_1@30 + IL_0000: ldsfld int32 ''.$assembly::arg_3@30 IL_0005: ret } - .method assembly specialname static int32 'get_arg_1@34-1'() cil managed + .method assembly specialname static int32 'get_arg_0@34-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_1@34-1' + IL_0000: ldsfld int32 ''.$assembly::'arg_0@34-1' IL_0005: ret } - .method assembly specialname static int32 'get_arg_1@38-2'() cil managed + .method assembly specialname static int32 'get_arg_1@34-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_1@38-2' + IL_0000: ldsfld int32 ''.$assembly::'arg_1@34-1' IL_0005: ret } - .method assembly specialname static int32 get_arg_2@30() cil managed + .method assembly specialname static int32 'get_arg_2@34-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::arg_2@30 + IL_0000: ldsfld int32 ''.$assembly::'arg_2@34-1' IL_0005: ret } - .method assembly specialname static int32 'get_arg_2@34-1'() cil managed + .method assembly specialname static int32 'get_arg_0@38-2'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_2@34-1' + IL_0000: ldsfld int32 ''.$assembly::'arg_0@38-2' IL_0005: ret } - .method assembly specialname static int32 'get_arg_2@38-2'() cil managed + .method assembly specialname static int32 'get_arg_1@38-2'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::'arg_2@38-2' + IL_0000: ldsfld int32 ''.$assembly::'arg_1@38-2' IL_0005: ret } - .method assembly specialname static int32 get_arg_3@30() cil managed + .method assembly specialname static int32 'get_arg_2@38-2'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 ''.$assembly::arg_3@30 + IL_0000: ldsfld int32 ''.$assembly::'arg_2@38-2' IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index a0c07c33e9b..c8843431ed9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -327,46 +327,43 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed + .method assembly specialname static int32 get_arg_0@30() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret + IL_0000: ldsfld int32 assembly::arg_0@30 + IL_0005: ret } - .method assembly specialname static int32 get_arg_0@30() cil managed + .method assembly specialname static int32 get_arg_1@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::arg_0@30 + IL_0000: ldsfld int32 assembly::arg_1@30 IL_0005: ret } - .method assembly specialname static int32 'get_arg_0@34-1'() cil managed + .method assembly specialname static int32 get_arg_2@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::'arg_0@34-1' + IL_0000: ldsfld int32 assembly::arg_2@30 IL_0005: ret } - .method assembly specialname static int32 'get_arg_0@38-2'() cil managed + .method assembly specialname static int32 get_arg_3@30() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::'arg_0@38-2' + IL_0000: ldsfld int32 assembly::arg_3@30 IL_0005: ret } - .method assembly specialname static int32 get_arg_1@30() cil managed + .method assembly specialname static int32 'get_arg_0@34-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::arg_1@30 + IL_0000: ldsfld int32 assembly::'arg_0@34-1' IL_0005: ret } @@ -378,27 +375,27 @@ IL_0005: ret } - .method assembly specialname static int32 'get_arg_1@38-2'() cil managed + .method assembly specialname static int32 'get_arg_2@34-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::'arg_1@38-2' + IL_0000: ldsfld int32 assembly::'arg_2@34-1' IL_0005: ret } - .method assembly specialname static int32 get_arg_2@30() cil managed + .method assembly specialname static int32 'get_arg_0@38-2'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::arg_2@30 + IL_0000: ldsfld int32 assembly::'arg_0@38-2' IL_0005: ret } - .method assembly specialname static int32 'get_arg_2@34-1'() cil managed + .method assembly specialname static int32 'get_arg_1@38-2'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::'arg_2@34-1' + IL_0000: ldsfld int32 assembly::'arg_1@38-2' IL_0005: ret } @@ -410,20 +407,23 @@ IL_0005: ret } - .method assembly specialname static int32 get_arg_3@30() cil managed + .method assembly specialname static int32 'get_arg_3@38-1'() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::arg_3@30 + IL_0000: ldsfld int32 assembly::'arg_3@38-1' IL_0005: ret } - .method assembly specialname static int32 'get_arg_3@38-1'() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldsfld int32 assembly::'arg_3@38-1' - IL_0005: ret + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret } .method assembly static void staticInitialization@() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 0097c30b164..2df0d35533a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/LetIfThenElse01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -157,6 +157,14 @@ IL_00b4: ret } + .method assembly specialname static class [runtime]System.Tuple`4 get_arg@1() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [runtime]System.Tuple`4 assembly::arg@1 + IL_0005: ret + } + .method private specialname rtspecialname static void .cctor() cil managed { @@ -168,14 +176,6 @@ IL_000c: ret } - .method assembly specialname static class [runtime]System.Tuple`4 get_arg@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [runtime]System.Tuple`4 assembly::arg@1 - IL_0005: ret - } - .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 9b64b730953..9c646debced 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Lock01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -50,17 +50,6 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly::init@ - IL_0006: ldsfld int32 ''.$assembly::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static bool get_lockTaken@1() cil managed { @@ -78,6 +67,17 @@ IL_0006: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl index abf97003994..7a83b1d3f19 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOff.OptimizeOn.il.bsl @@ -42,22 +42,22 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public specialname static int32 get_x() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 get_format@1() cil managed { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 - IL_0000: ldc.i4.1 - IL_0001: ret + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 ''.$assembly::format@1 + IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 get_format@1() cil managed + .method public specialname static int32 get_x() cil managed { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 ''.$assembly::format@1 - IL_0005: ret + IL_0000: ldc.i4.1 + IL_0001: ret } .property class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 66772bf729a..48c47f52b7c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ModuleWithExpression01.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -44,6 +44,14 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) .field static assembly class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 format@1 .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 get_format@1() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 assembly/M::format@1 + IL_0005: ret + } + .method public specialname static int32 get_x() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -65,14 +73,6 @@ IL_000c: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 get_format@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 assembly/M::format@1 - IL_0005: ret - } - .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl index 23409788a03..95625985eee 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/AnonRecords.fs.il.net472.bsl @@ -373,9 +373,7 @@ IL_000e: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .param [1] @@ -547,9 +545,7 @@ IL_000d: ret } - .method public hidebysig instance bool - Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(class '<>f__AnonymousType2430756162`3'j__TPar',!'j__TPar',!'j__TPar'> obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -611,9 +607,7 @@ IL_0052: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .param [1] @@ -771,9 +765,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.RealInternalSignatureOn.OptimizeOn.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.RealInternalSignatureOn.OptimizeOn.il.net472.bsl index 43b4d63535e..a6e2769acb9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.RealInternalSignatureOn.OptimizeOn.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.RealInternalSignatureOn.OptimizeOn.il.net472.bsl @@ -1,21 +1,26 @@ + + + + + .assembly extern runtime { } .assembly extern FSharp.Core { } .assembly extern netstandard { -.publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) -.ver 2:1:0:0 + .publickeytoken = (CC 7B 13 FF CD 2D DD 51 ) + .ver 2:1:0:0 } .assembly assembly { -.custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, -int32, -int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) - - + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + -.hash algorithm 0x00008004 -.ver 0:0:0:0 + .hash algorithm 0x00008004 + .ver 0:0:0:0 } .module assembly.exe @@ -30,109 +35,115 @@ int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) .class public abstract auto ansi sealed assembly -extends [runtime]System.Object -{ -.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) -.class auto ansi serializable nested public C -extends [runtime]System.Object -{ -.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) -.field assembly string x -.field assembly string x@8 -.method public specialname rtspecialname instance void .ctor() cil managed + extends [runtime]System.Object { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable nested public C + extends [runtime]System.Object + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) + .field assembly string x + .field assembly string x@8 + .method public specialname rtspecialname instance void .ctor() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: callvirt instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: pop + IL_0008: ldarg.0 + IL_0009: call string [runtime]System.Console::ReadLine() + IL_000e: stfld string assembly/C::x + IL_0013: ldarg.0 + IL_0014: call string [runtime]System.Console::ReadLine() + IL_0019: stfld string assembly/C::x@8 + IL_001e: ret + } + + .method public hidebysig instance string M() cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string assembly/C::x@8 + IL_0006: ldarg.0 + IL_0007: callvirt instance string assembly/C::g() + IL_000c: call string [runtime]System.String::Concat(string, + string) + IL_0011: ret + } + + .method assembly hidebysig instance string g() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld string assembly/C::x + IL_0006: ret + } + + } + + .method public static class [runtime]System.Tuple`2 f(!!a x) cil managed + { + + .maxstack 8 + IL_0000: ldnull + IL_0001: call void assembly::g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_0006: nop + IL_0007: ldnull + IL_0008: ldnull + IL_0009: call void assembly::g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_000e: nop + IL_000f: ldnull + IL_0010: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_0015: ret + } + + .method assembly static void g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + { + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 V_0) + IL_0000: ldstr "Hello" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_000a: stloc.0 + IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() + IL_0010: ldloc.0 + IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0016: pop + IL_0017: ldstr "Hello" + IL_001c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) + IL_0021: stloc.0 + IL_0022: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() + IL_0027: ldloc.0 + IL_0028: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, + class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_002d: pop + IL_002e: ret + } -.maxstack 8 -IL_0000: ldarg.0 -IL_0001: callvirt instance void [runtime]System.Object::.ctor() -IL_0006: ldarg.0 -IL_0007: pop -IL_0008: ldarg.0 -IL_0009: call string [runtime]System.Console::ReadLine() -IL_000e: stfld string assembly/C::x -IL_0013: ldarg.0 -IL_0014: call string [runtime]System.Console::ReadLine() -IL_0019: stfld string assembly/C::x@8 -IL_001e: ret } -.method public hidebysig instance string M() cil managed -{ - -.maxstack 8 -IL_0000: ldarg.0 -IL_0001: ldfld string assembly/C::x@8 -IL_0006: ldarg.0 -IL_0007: callvirt instance string assembly/C::g() -IL_000c: call string [runtime]System.String::Concat(string, -string) -IL_0011: ret -} - -.method assembly hidebysig instance string g() cil managed -{ -.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - -.maxstack 8 -IL_0000: ldarg.0 -IL_0001: ldfld string assembly/C::x -IL_0006: ret -} - -} - -.method public static class [runtime]System.Tuple`2 f(!!a x) cil managed +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object { + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } -.maxstack 8 -IL_0000: ldnull -IL_0001: call void assembly::g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit) -IL_0006: nop -IL_0007: ldnull -IL_0008: ldnull -IL_0009: call void assembly::g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit) -IL_000e: nop -IL_000f: ldnull -IL_0010: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, -!1) -IL_0015: ret } -.method assembly static void g@12(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed -{ -.maxstack 4 -.locals init (class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 V_0) -IL_0000: ldstr "Hello" -IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) -IL_000a: stloc.0 -IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() -IL_0010: ldloc.0 -IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, -class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) -IL_0016: pop -IL_0017: ldstr "Hello" -IL_001c: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) -IL_0021: stloc.0 -IL_0022: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() -IL_0027: ldloc.0 -IL_0028: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, -class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) -IL_002d: pop -IL_002e: ret -} -} -.class private abstract auto ansi sealed ''.$assembly -extends [runtime]System.Object -{ -.method public static void main@() cil managed -{ -.entrypoint -.maxstack 8 -IL_0000: ret -} -} \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOff.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOff.OptimizeOn.il.bsl index 14988831b07..6ec0bc58182 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOff.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOff.OptimizeOn.il.bsl @@ -166,6 +166,14 @@ IL_0005: ret } + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> get_format@1() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::format@1 + IL_0005: ret + } + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_functionResult() cil managed { @@ -174,7 +182,15 @@ IL_0005: ret } - .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'f@26-1'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 _arg1) cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> 'get_format@1-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::'format@1-1' + IL_0005: ret + } + + .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f@7(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 l) cil managed { .maxstack 4 @@ -205,7 +221,7 @@ IL_0029: ldarg.0 IL_002a: ldloc.1 - IL_002b: starg.s _arg1 + IL_002b: starg.s l IL_002d: starg.s condition IL_002f: br.s IL_0000 @@ -216,7 +232,7 @@ IL_0038: ret } - .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f@7(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 l) cil managed + .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'f@26-1'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 _arg1) cil managed { .maxstack 4 @@ -247,7 +263,7 @@ IL_0029: ldarg.0 IL_002a: ldloc.1 - IL_002b: starg.s l + IL_002b: starg.s _arg1 IL_002d: starg.s condition IL_002f: br.s IL_0000 @@ -258,22 +274,6 @@ IL_0038: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> get_format@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::format@1 - IL_0005: ret - } - - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> 'get_format@1-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::'format@1-1' - IL_0005: ret - } - .property class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list() { diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOn.OptimizeOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOn.OptimizeOn.il.bsl index 14988831b07..6ec0bc58182 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOn.OptimizeOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/Verify13043.fs.RealInternalSignatureOn.OptimizeOn.il.bsl @@ -166,6 +166,14 @@ IL_0005: ret } + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> get_format@1() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::format@1 + IL_0005: ret + } + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_functionResult() cil managed { @@ -174,7 +182,15 @@ IL_0005: ret } - .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'f@26-1'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 _arg1) cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> 'get_format@1-1'() cil managed + { + + .maxstack 8 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::'format@1-1' + IL_0005: ret + } + + .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f@7(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 l) cil managed { .maxstack 4 @@ -205,7 +221,7 @@ IL_0029: ldarg.0 IL_002a: ldloc.1 - IL_002b: starg.s _arg1 + IL_002b: starg.s l IL_002d: starg.s condition IL_002f: br.s IL_0000 @@ -216,7 +232,7 @@ IL_0038: ret } - .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f@7(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 l) cil managed + .method assembly static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'f@26-1'(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 condition, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 _arg1) cil managed { .maxstack 4 @@ -247,7 +263,7 @@ IL_0029: ldarg.0 IL_002a: ldloc.1 - IL_002b: starg.s l + IL_002b: starg.s _arg1 IL_002d: starg.s condition IL_002f: br.s IL_0000 @@ -258,22 +274,6 @@ IL_0038: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> get_format@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::format@1 - IL_0005: ret - } - - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> 'get_format@1-1'() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4,class [FSharp.Core]Microsoft.FSharp.Core.Unit>,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit> ''.$assembly::'format@1-1' - IL_0005: ret - } - .property class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 list() { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl index 18e650cc8b8..61dc0c7c4b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithExtensionMethod.fsx.realInternalSignatureOn.il.bsl @@ -111,17 +111,6 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class assembly/Foo get_f@9() cil managed { @@ -138,6 +127,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl index 84634a5460b..d4ffb003d44 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOff.il.bsl @@ -393,11 +393,11 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_todo2() cil managed + .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 get_matchValue@25() cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> ''.$assembly$fsx::todo2@35 + IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ''.$assembly$fsx::matchValue@25 IL_0005: ret } @@ -409,27 +409,27 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> 'get_computation@44-1'() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_todo2() cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> ''.$assembly$fsx::'computation@44-1' + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> ''.$assembly$fsx::todo2@35 IL_0005: ret } - .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 get_matchValue@25() cil managed + .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 'get_matchValue@44-1'() cil managed { .maxstack 8 - IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ''.$assembly$fsx::matchValue@25 + IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ''.$assembly$fsx::'matchValue@44-1' IL_0005: ret } - .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 'get_matchValue@44-1'() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> 'get_computation@44-1'() cil managed { .maxstack 8 - IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 ''.$assembly$fsx::'matchValue@44-1' + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> ''.$assembly$fsx::'computation@44-1' IL_0005: ret } diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl index 5456e1c47f5..f98d3d3a6db 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithLastOpenedTypeExtensions.fsx.realInternalSignatureOn.il.bsl @@ -417,55 +417,55 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_todo2() cil managed + .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 get_matchValue@25() cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::todo2@35 + IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 assembly::matchValue@25 IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_computation@25() cil managed { .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::computation@25 + IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_computation@25() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> get_todo2() cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::computation@25 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::todo2@35 IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> 'get_computation@44-1'() cil managed + .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 'get_matchValue@44-1'() cil managed { .maxstack 8 - IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::'computation@44-1' + IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 assembly::'matchValue@44-1' IL_0005: ret } - .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 get_matchValue@25() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> 'get_computation@44-1'() cil managed { .maxstack 8 - IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 assembly::matchValue@25 + IL_0000: ldsfld class [FSharp.Core]Microsoft.FSharp.Control.FSharpAsync`1> assembly::'computation@44-1' IL_0005: ret } - .method assembly specialname static valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 'get_matchValue@44-1'() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 8 - IL_0000: ldsfld valuetype [FSharp.Core]Microsoft.FSharp.Core.FSharpResult`2 assembly::'matchValue@44-1' - IL_0005: ret + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret } .method assembly static void staticInitialization@() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl index b29d9d083fb..cb0286dc082 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowWithTypeExtension.fsx.realInternalSignatureOn.il.bsl @@ -110,17 +110,6 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class assembly/Foo get_f@8() cil managed { @@ -137,6 +126,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl index 09e19aa0a1b..833b0b9ec4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Shadowing/ShadowingAndStillOkWithChainedCalls.fsx.realInternalSignatureOn.il.bsl @@ -133,17 +133,6 @@ IL_0005: ret } - .method private specialname rtspecialname static void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$assembly$fsx::init@ - IL_0006: ldsfld int32 ''.$assembly$fsx::init@ - IL_000b: pop - IL_000c: ret - } - .method assembly specialname static class assembly/Foo get_f@10() cil managed { @@ -160,6 +149,17 @@ IL_0005: ret } + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly$fsx::init@ + IL_0006: ldsfld int32 ''.$assembly$fsx::init@ + IL_000b: pop + IL_000c: ret + } + .method assembly static void staticInitialization@() cil managed { diff --git a/tests/ILVerify/ilverify.ps1 b/tests/ILVerify/ilverify.ps1 index d59e325b30f..1b32a044609 100644 --- a/tests/ILVerify/ilverify.ps1 +++ b/tests/ILVerify/ilverify.ps1 @@ -4,11 +4,11 @@ function Normalize-IlverifyOutputLine { param( [string]$line ) - # Remove F# closure suffixes: +clo@NNN-NNN, +clo@NNN, +NAME@NNN-NNN, +NAME@NNN + # Remove F# closure suffixes: +clo@NNN[-NNN], +NAME@NNN[-NNN] $line = $line -replace '(\+\w+)@\d+(-\d+)?', '$1' # Remove patterns like "Pipe #1 stage #1 at line 1782@1782" $line = $line -replace 'Pipe #\d+ stage #\d+ at line \d+@\d+', '' - # Remove function suffixes like NAME@NNN or NAME@NNN-NNN in method names + # Remove function suffixes like NAME@NNN[-NNN] in method names $line = $line -replace '(\w+)@\d+(-\d+)?', '$1' # Remove 'at line NNNN' $line = $line -replace 'at line \d+', '' diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs index 0d678b442d1..d370e21be95 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/DeterministicTests.fs @@ -2,6 +2,7 @@ namespace FSharp.Compiler.UnitTests.CodeGen.EmittedIL +open System open System.IO open FSharp.Test open FSharp.Test.Compiler @@ -336,21 +337,15 @@ let inline myFunc x y = x - y""" // https://github.com/dotnet/fsharp/issues/19732 // Multi-file optimized compilation exercises DetupleArgs and TLR (tuple-arg - // functions + nested lambdas). These passes iterate Val sets whose order - // depends on Val.Stamp, which is racy under parallel optimization. - // The fix sorts by source position (valSourceOrderKey) before iterating. - // Note: this in-process test is a regression guard; the full race requires - // large-scale parallel compilation tested by eng/test-determinism.ps1 in Release. + // functions + nested lambdas); without source-order Val iteration their + // output races under parallel optimization. The full race needs eng/test-determinism.ps1 + // in Release — this is a regression guard. [] let ``Optimized multi-file assembly should be deterministic`` () = - let outputDir = DirectoryInfo(Path.Combine(Path.GetTempPath(), "fsharp-determinism-test")) - if outputDir.Exists then outputDir.Delete(true) + let outputDir = DirectoryInfo(Path.Combine(Path.GetTempPath(), $"fsharp-determinism-{Guid.NewGuid():N}")) outputDir.Create() - let makeFile i = - FsSourceWithFileName - $"File%d{i}.fs" - $""" + let fileBody i = $""" module File%d{i} let processTuple%d{i} (a: int, b: string) = @@ -366,26 +361,9 @@ let callSite%d{i} () = nested () """ - let additionalFiles = [ for i in 2..8 -> makeFile i ] - let getMvid () = - FSharp - """ -module File1 - -let processTuple1 (a: int, b: string) = - let inner x = x + a - (inner 1, b.Length) - -let callSite1 () = - let r1 = processTuple1 (42, "hello") - let r2 = processTuple1 (99, "world") - let nested () = - let deep () = fst r1 + fst r2 - deep () - nested () -""" - |> withAdditionalSourceFiles additionalFiles + FSharp(fileBody 1) + |> withAdditionalSourceFiles [ for i in 2..8 -> FsSourceWithFileName $"File%d{i}.fs" (fileBody i) ] |> asLibrary |> withOptimize |> withName "DetTest" @@ -393,12 +371,13 @@ let callSite1 () = |> withOptions [ "--deterministic" ] |> compileGuid - let mvids = [| for _ in 1..10 -> getMvid () |] - - for i in 1 .. mvids.Length - 1 do - Assert.Equal(mvids.[0], mvids.[i]) + try + let mvids = [| for _ in 1..10 -> getMvid () |] - outputDir.Delete(true) + for i in 1 .. mvids.Length - 1 do + Assert.Equal(mvids.[0], mvids.[i]) + finally + outputDir.Delete(true) [] let ``Reference assemblies MVID must change when literal constant value changes`` () = @@ -417,3 +396,167 @@ let X = 43 let mvid1, mvid2 = calculateRefAssMvids codeWithLiteral42 codeWithLiteral43 // Different literal values should produce different MVIDs Assert.NotEqual(mvid1, mvid2) + + // Guards stableValKey total ordering: same-arity overloads (f(int) vs f(string)) + // must serialize in deterministic order in p_ModuleInfo optimization data. + [] + let ``Overloaded members produce deterministic MVID`` () = + let outputDir = DirectoryInfo(Path.Combine(Path.GetTempPath(), $"fsharp-overload-{Guid.NewGuid():N}")) + outputDir.Create() + + let libFile = """ +module OverloadLib + +type Processor() = + member _.Handle(x: int) = x * 2 + member _.Handle(x: string) = x.Length + member _.Handle(x: float) = int x + member _.Handle(x: int, y: int) = x + y +""" + + let consumerFile = """ +module Consumer + +let run () = + let p = OverloadLib.Processor() + p.Handle(42) + p.Handle("hello") + p.Handle(3.14) + p.Handle(1, 2) +""" + + let getMvid () = + FSharp(libFile) + |> withAdditionalSourceFiles [ FsSourceWithFileName "Consumer.fs" consumerFile ] + |> asLibrary + |> withOptimize + |> withName "OverloadTest" + |> withOutputDirectory (Some outputDir) + |> withOptions [ "--deterministic"; "--nowarn:75" ] + |> compileGuid + + try + Assert.Equal(getMvid (), getMvid ()) + finally + outputDir.Delete(true) + + // https://github.com/dotnet/fsharp/issues/19928 + // The core SEQ=PAR invariant: sequential and parallel codegen must produce identical output. + // Exercises cross-file inlined closures, byte arrays, and the full deferred drain pipeline. + [] + let ``Sequential and parallel codegen produce identical MVID`` () = + let outputDir = DirectoryInfo(Path.Combine(Path.GetTempPath(), $"fsharp-seqpar-{Guid.NewGuid():N}")) + outputDir.Create() + + let libFile = """ +module Lib + +let inline withClosure f x = (fun y -> f y + x) 1 + +let data1 = [| 0uy .. 200uy |] +let data2 = [| 1us; 2us; 3us; 4us; 5us; 6us; 7us; 8us |] +""" + + let consumerFile i = $""" +module Consumer%d{i} + +let result%d{i} () = + let v = Lib.withClosure (fun y -> y * %d{i}) %d{i + 10} + v + int Lib.data1.[%d{i}] + int Lib.data2.[%d{i % 8}] +""" + + let getMvid (parallelFlag: string) = + FSharp(libFile) + |> withAdditionalSourceFiles [ for i in 1..30 -> FsSourceWithFileName $"Consumer%d{i}.fs" (consumerFile i) ] + |> asLibrary + |> withOptimize + |> withName "SeqParTest" + |> withOutputDirectory (Some outputDir) + |> withOptions [ "--deterministic"; "--nowarn:75"; parallelFlag ] + |> compileGuid + + try + let seqMvid = getMvid "--parallelcompilation-" + let parMvid = getMvid "--parallelcompilation+" + Assert.Equal(seqMvid, parMvid) + finally + outputDir.Delete(true) + + // bytesKey correctness: two distinct inline byte arrays in one function body get the same + // range after remarkExpr inlining. Without bytesKey they would alias → wrong runtime values. + [] + let ``Inline byte arrays with same range produce distinct correct values`` () = + let libFile = """ +module Lib +let inline twoArrays () = ([| 10uy; 20uy; 30uy; 40uy; 50uy; 60uy |], [| 99uy; 88uy; 77uy; 66uy; 55uy; 44uy |]) +""" + + let mainFile = """ +module Main +[] +let main _ = + let (a, b) = Lib.twoArrays () + if a.[0] = 10uy && b.[0] = 99uy then + printfn "OK" + 0 + else + printfn "FAIL: %d %d" a.[0] b.[0] + 1 +""" + + FSharp(libFile) + |> withAdditionalSourceFiles [ FsSourceWithFileName "Main.fs" mainFile ] + |> asExe + |> withOptimize + |> withOptions [ "--deterministic"; "--nowarn:75"; "--parallelcompilation+" ] + |> compileAndRun + |> shouldSucceed + |> withStdOutContains "OK" + |> ignore + + // Verify that compiled output actually runs correctly — not just that IL is identical. + // Guards against the FSharpPlus-class runtime hang caused by dropped .cctor initialization. + [] + [] + [] + let ``Deterministic multi-file compile produces correct runtime behavior`` (parallelFlag: string) = + let mainFile = """ +module Main + +[] +let main _ = + let r1 = ModuleA.valueA + let r2 = ModuleB.valueB + if r1 = 42 && r2 = 99 then + printfn "OK" + 0 + else + printfn "FAIL: %d %d" r1 r2 + 1 +""" + + let moduleA = """ +module ModuleA + +let mutable sideEffect = 0 +do sideEffect <- 42 +let valueA = sideEffect +""" + + let moduleB = """ +module ModuleB + +let mutable sideEffect = 0 +do sideEffect <- 99 +let valueB = sideEffect +""" + + FSharp(moduleA) + |> withAdditionalSourceFiles [ + FsSourceWithFileName "ModuleB.fs" moduleB + FsSourceWithFileName "Main.fs" mainFile + ] + |> asExe + |> withOptimize + |> withOptions [ "--deterministic"; "--nowarn:75"; parallelFlag ] + |> compileAndRun + |> shouldSucceed + |> withStdOutContains "OK" + |> ignore From bfbfb33f582e0de5d0c2a702076aae10b4b8432b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:23:18 +0200 Subject: [PATCH 06/11] Update dependencies from https://github.com/dotnet/roslyn build 20260706.6 (#20037) On relative base path root Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.Compilers , Microsoft.CodeAnalysis.CSharp , Microsoft.CodeAnalysis.EditorFeatures , Microsoft.CodeAnalysis.EditorFeatures.Text , Microsoft.CodeAnalysis.ExternalAccess.FSharp , Microsoft.CodeAnalysis.Features , Microsoft.VisualStudio.LanguageServices From Version 5.10.0-1.26352.10 -> To Version 5.10.0-1.26356.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.props | 16 ++++++++-------- eng/Version.Details.xml | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 7cff1796ae9..bf9ac2ce209 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -19,14 +19,14 @@ This file should be imported by eng/Versions.props 1.0.0-prerelease.26318.1 1.0.0-prerelease.26318.1 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 - 5.10.0-1.26352.10 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 + 5.10.0-1.26356.6 10.0.2 10.0.2 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 46df1a092e4..3960e571dcb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,37 +18,37 @@ https://github.com/dotnet/msbuild e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df - + https://github.com/dotnet/roslyn - 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb + ed7c2f0b8555529c2abd079945dbc918f0e009df From 423c4b86bc54b8352443696d7f082aefb92beda8 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 14:25:15 +0200 Subject: [PATCH 07/11] Fix ppc64le stack overflow from deep Sequential chains in graph checking (#20028) --- .../.FSharp.Compiler.Service/11.0.100.md | 1 + .../GraphChecking/FileContentMapping.fs | 3 +- src/Compiler/Service/ServiceParsedInputOps.fs | 13 -------- .../Service/ServiceParsedInputOps.fsi | 2 -- src/Compiler/SyntaxTree/SyntaxTreeOps.fs | 16 ++++++++++ src/Compiler/SyntaxTree/SyntaxTreeOps.fsi | 6 ++++ .../Graph/FileContentMappingTests.fs | 31 +++++++++++++++++++ 7 files changed, 55 insertions(+), 17 deletions(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 0552480fb6c..28d45ebb49c 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -68,6 +68,7 @@ * Fix O(n) `TypeStructure.GetHashCode` performance regression causing sustained high CPU in IDE mode with generative type providers. ([Issue #18925](https://github.com/dotnet/fsharp/issues/18925), [PR #19369](https://github.com/dotnet/fsharp/pull/19369)) * Fix TypeLoadException when creating delegate with voidptr parameter. (Issue [#11132](https://github.com/dotnet/fsharp/issues/11132), [PR #19338](https://github.com/dotnet/fsharp/pull/19338)) * Suppress tail calls when localloc (NativePtr.stackalloc) is used. (Issue [#13447](https://github.com/dotnet/fsharp/issues/13447), [PR #19338](https://github.com/dotnet/fsharp/pull/19338)) +* Fix stack overflow when graph-checking long statement sequences on platforms with large stack frames (e.g. Mono ppc64le), by flattening `SynExpr.Sequential` chains in `FileContentMapping`. ([Issue #19988](https://github.com/dotnet/fsharp/issues/19988), [PR #20028](https://github.com/dotnet/fsharp/pull/20028)) * Fix TypeLoadException in Release builds with inline constraints. (Issue [#14492](https://github.com/dotnet/fsharp/issues/14492), [PR #19338](https://github.com/dotnet/fsharp/pull/19338)) * Fix nativeptr in interfaces leads to TypeLoadException. (Issue [#14508](https://github.com/dotnet/fsharp/issues/14508), [PR #19338](https://github.com/dotnet/fsharp/pull/19338)) * Fix box instruction for literal upcasts. (Issue [#18319](https://github.com/dotnet/fsharp/issues/18319), [PR #19338](https://github.com/dotnet/fsharp/pull/19338)) diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index 6f13677025b..38ce5a8d8cd 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -454,8 +454,7 @@ let visitSynExpr (e: SynExpr) : FileContentEntry list = | SynExpr.TryFinally(tryExpr = tryExpr; finallyExpr = finallyExpr) -> visit tryExpr (fun tNodes -> visit finallyExpr (fun fNodes -> tNodes @ fNodes |> continuation)) | SynExpr.Lazy(expr, _) -> visit expr continuation - | SynExpr.Sequential(expr1 = expr1; expr2 = expr2) -> - visit expr1 (fun nodes1 -> visit expr2 (fun nodes2 -> nodes1 @ nodes2 |> continuation)) + | SynExpr.Sequential _ as seqExpr -> Continuation.concatenate (List.map visit (flattenSequentials seqExpr)) continuation | SynExpr.IfThenElse(ifExpr = ifExpr; thenExpr = thenExpr; elseExpr = elseExpr) -> let continuations = List.map visit (ifExpr :: thenExpr :: Option.toList elseExpr) Continuation.concatenate continuations continuation diff --git a/src/Compiler/Service/ServiceParsedInputOps.fs b/src/Compiler/Service/ServiceParsedInputOps.fs index 8724712440c..00dbde0eae9 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fs +++ b/src/Compiler/Service/ServiceParsedInputOps.fs @@ -270,19 +270,6 @@ module Entity = module ParsedInput = - /// A pattern that collects all sequential expressions to avoid StackOverflowException - let internal (|Sequentials|_|) expr = - - let rec collect expr acc = - match expr with - | SynExpr.Sequential(expr1 = e1; expr2 = SynExpr.Sequential _ as e2) -> collect e2 (e1 :: acc) - | SynExpr.Sequential(expr1 = e1; expr2 = e2) -> e2 :: e1 :: acc - | _ -> acc - - match collect expr [] with - | [] -> None - | exprs -> Some(List.rev exprs) - let emptyStringSet = HashSet() let GetRangeOfExprLeftOfDot (pos: pos, parsedInput) = diff --git a/src/Compiler/Service/ServiceParsedInputOps.fsi b/src/Compiler/Service/ServiceParsedInputOps.fsi index d99277893d4..b063468dc50 100644 --- a/src/Compiler/Service/ServiceParsedInputOps.fsi +++ b/src/Compiler/Service/ServiceParsedInputOps.fsi @@ -160,8 +160,6 @@ type public InsertionContextEntity = /// Operations querying the entire syntax tree module public ParsedInput = - /// A pattern that collects all sequential expressions to avoid StackOverflowException - val internal (|Sequentials|_|): SynExpr -> SynExpr list option val TryFindExpressionASTLeftOfDotLeftOfCursor: pos: pos * parsedInput: ParsedInput -> (pos * bool) option diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index 1fb56dd697d..fa30545d480 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -299,6 +299,22 @@ let (|SynExprParen|_|) (e: SynExpr) = | SynExpr.Paren(SynExprErrorSkip e, a, b, c) -> ValueSome(e, a, b, c) | _ -> ValueNone +/// Collects the ordered sub-expressions of nested `SynExpr.Sequential`, avoiding deep recursion (empty if not a Sequential). +let flattenSequentials expr = + let rec collect expr acc = + match expr with + | SynExpr.Sequential(expr1 = e1; expr2 = SynExpr.Sequential _ as e2) -> collect e2 (e1 :: acc) + | SynExpr.Sequential(expr1 = e1; expr2 = e2) -> e2 :: e1 :: acc + | _ -> acc + + List.rev (collect expr []) + +/// A pattern that collects all sequential expressions to avoid StackOverflowException +let (|Sequentials|_|) expr = + match flattenSequentials expr with + | [] -> None + | exprs -> Some exprs + let (|SynPatErrorSkip|) (p: SynPat) = match p with | SynPat.FromParseError(p, _) -> p diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index cb5fe46a1b6..246d661e663 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -87,6 +87,12 @@ val (|SynExprErrorSkip|): p: SynExpr -> SynExpr [] val (|SynExprParen|_|): e: SynExpr -> (SynExpr * range * range option * range) voption +/// Collects the ordered sub-expressions of nested `SynExpr.Sequential`, avoiding deep recursion (empty if not a Sequential). +val flattenSequentials: expr: SynExpr -> SynExpr list + +/// A pattern that collects all sequential expressions to avoid StackOverflowException +val (|Sequentials|_|): SynExpr -> SynExpr list option + val (|SynPatErrorSkip|): p: SynPat -> SynPat /// Push non-simple parts of a patten match over onto the r.h.s. of a lambda. diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs index 070133a3d8d..e63654540a8 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs @@ -122,6 +122,37 @@ module B = C | [ TopLevelNamespace "" [ PrefixedIdentifier "C" ] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") +[] +let ``Long sequential chain captures all identifiers in order`` () = + // Regression test for https://github.com/dotnet/fsharp/issues/19988: a long statement + // sequence parses into a deeply nested SynExpr.Sequential chain, which is now flattened + // before traversal. Verifies the flattening preserves order and captures every entry. + let count = 10000 + + let statements = + [ for i in 0 .. count - 1 -> $" Ns{i}.f ()" ] |> String.concat "\n" + + let content = + getContent + false + $""" +module X.Y.Z + +let fn () = +{statements} +""" + + match content with + | [ TopLevelNamespace "X.Y" entries ] -> + let identifiers = + entries + |> List.map (function + | FileContentEntry.PrefixedIdentifier path -> String.concat "." path + | other -> failwith $"Unexpected entry: {other}") + + Assert.Equal([ for i in 0 .. count - 1 -> $"Ns{i}" ], identifiers) + | content -> Assert.Fail($"Unexpected content: {content}") + module InvalidSyntax = From 527a6c3c19827f0801197b76e9e5480e9e7562ab Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 7 Jul 2026 18:00:58 +0200 Subject: [PATCH 08/11] Fix #13099: optimizer drops side-effectful receiver of unit member access in task CE (#19885) --- .../.FSharp.Compiler.Service/11.0.100.md | 1 + src/Compiler/Optimize/LowerStateMachines.fs | 20 +- .../FSharp.Compiler.ComponentTests.fsproj | 1 + .../Optimizations/TaskCEUnitPropertyAccess.fs | 205 ++++++++++++++++++ 4 files changed, 220 insertions(+), 7 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/Optimizations/TaskCEUnitPropertyAccess.fs diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 28d45ebb49c..47210a580fd 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -1,5 +1,6 @@ ### Fixed +* Fix state machine lowering dropping the side-effectful receiver of an unused unit-typed member access (e.g. inside `task { (effectful()).UnitProp }`). ([Issue #13099](https://github.com/dotnet/fsharp/issues/13099), [PR #19885](https://github.com/dotnet/fsharp/pull/19885)) * `--deterministic` Release builds now produce byte-identical `FSharp.Compiler.Service.dll` under `--parallelcompilation+` and `--parallelcompilation-`, so it is restored to the determinism gate (now also checked sequential-vs-parallel). Code generation runs the same deferred per-file drain in both modes, with type/member/field emit-order keys and generated names derived from the file being emitted rather than thread-scheduling order. ([Issue #19928](https://github.com/dotnet/fsharp/issues/19928), [PR #19929](https://github.com/dotnet/fsharp/pull/19929)) * Fix `[]` silently producing duplicate IL entries (FS0192/FS2014) when applied to a multi-value let-binding (e.g. `let a, b = 1, 2`); now emits FS0755 at type-check time. ([Issue #6131](https://github.com/dotnet/fsharp/issues/6131), [PR #19924](https://github.com/dotnet/fsharp/pull/19924)) * Fix FS3236 when taking the address of an untyped generalized `let` binding (e.g. `let ffff = ValueNone`) passed to an `inref` parameter. ([Issue #19608](https://github.com/dotnet/fsharp/issues/19608), [PR #19948](https://github.com/dotnet/fsharp/pull/19948)) diff --git a/src/Compiler/Optimize/LowerStateMachines.fs b/src/Compiler/Optimize/LowerStateMachines.fs index a82d57d0789..9b75685f865 100644 --- a/src/Compiler/Optimize/LowerStateMachines.fs +++ b/src/Compiler/Optimize/LowerStateMachines.fs @@ -175,23 +175,29 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = pcCount // Record definitions for any resumable code - let rec BindResumableCodeDefinitions (env: env) expr = + let rec BindResumableCodeDefinitions (env: env) finalizing expr = match expr with // Bind 'let __expand_ABC = bindExpr in bodyExpr' - | Expr.Let (defn, bodyExpr, _, _) when isStateMachineBindingVar g defn.Var -> + | Expr.Let (defn, bodyExpr, m, _) when isStateMachineBindingVar g defn.Var -> if sm_verbose then printfn "binding %A --> %A..." defn.Var defn.Expr let envR = { env with ResumableCodeDefns = env.ResumableCodeDefns.Add defn.Var defn.Expr } - BindResumableCodeDefinitions envR bodyExpr + let envR2, bodyR = BindResumableCodeDefinitions envR finalizing bodyExpr + // A dropped member-access receiver temp loses its side effect when unused (#13099). + if finalizing && defn.Var.IsMemberThisVal && Optimizer.ExprHasEffect Optimizer.EffectContext.Emit g defn.Expr && + not (Zset.contains defn.Var (freeInExpr CollectLocals bodyExpr).FreeLocals) then + envR2, mkSequential m defn.Expr bodyR + else + envR2, bodyR // Eliminate 'if __useResumableCode ...' | IfUseResumableStateMachinesExpr g (thenExpr, _) -> if sm_verbose then printfn "eliminating 'if __useResumableCode...'" - BindResumableCodeDefinitions env thenExpr + BindResumableCodeDefinitions env finalizing thenExpr // Look through debug points to find resumable code bindings inside | Expr.DebugPoint (_, innerExpr) -> - let envR, _ = BindResumableCodeDefinitions env innerExpr + let envR, _ = BindResumableCodeDefinitions env finalizing innerExpr (envR, expr) | _ -> @@ -398,7 +404,7 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = /// Repeatedly find outermost expansion definitions and apply outermost expansions let rec RepeatBindAndApplyOuterDefinitions (env: env) expr = if sm_verbose then printfn "RepeatBindAndApplyOuterDefinitions for %A..." expr - let env2, expr2 = BindResumableCodeDefinitions env expr + let env2, expr2 = BindResumableCodeDefinitions env true expr match TryReduceExpr env2 expr2 [] id with | Some res -> RepeatBindAndApplyOuterDefinitions env2 res | None -> env2, expr2 @@ -409,7 +415,7 @@ type LowerStateMachine(g: TcGlobals, outerResumableCodeDefns: ValMap) = // All expanded resumable code state machines e.g. 'task { .. }' begin with a bind of @builder or 'defn' // Seed the env with any expand-var definitions from outer scopes (e.g. across lambda boundaries) let initialEnv = { env.Empty with ResumableCodeDefns = outerResumableCodeDefns } - let env, expr = BindResumableCodeDefinitions initialEnv inputExpr + let env, expr = BindResumableCodeDefinitions initialEnv false inputExpr match expr with | StructStateMachineExpr g (dataTy, diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index f045130aa8e..5070905529f 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -279,6 +279,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/Optimizations/TaskCEUnitPropertyAccess.fs b/tests/FSharp.Compiler.ComponentTests/Optimizations/TaskCEUnitPropertyAccess.fs new file mode 100644 index 00000000000..e100f12501f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Optimizations/TaskCEUnitPropertyAccess.fs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Optimizations + +open Xunit +open FSharp.Test.Compiler + +// Regression tests for https://github.com/dotnet/fsharp/issues/13099 +// State machine lowering dropped an unused `let this = receiver in ()` binding, discarding the +// receiver's side effect. Each test compiles under Debug and Release and asserts it is observed. +// Snippets run in-process via reflection, so use `failwith` (not `exit`) to signal failure. +module TaskCEUnitPropertyAccess = + + let private run (optimize: bool) (source: string) = + Fsx source + |> asExe + |> withOptimization optimize + |> compileExeAndRun + |> shouldSucceed + |> ignore + + [] // Debug + [] // Release + [] + let ``TaskCE_UnitPropertyAccess_PreservesReceiverSideEffects`` (optimize: bool) = + run optimize """ +type SomeOutputType() = + member x.End = () + +let someFunctionWithReturnType () = + failwith "This should be raised" + SomeOutputType() + +let theTaskAtHand () = + task { (someFunctionWithReturnType ()).End } + +try + theTaskAtHand().Wait() + failwith "Expected exception was not raised; the optimizer dropped the side-effectful receiver." +with +| :? System.AggregateException as ex when ex.InnerException.Message = "This should be raised" -> () +""" + + [] + [] + [] + let ``UnitPropertyAccess_OnSideEffectfulReceiver_OutsideTaskCE_Raises`` (optimize: bool) = + run optimize """ +type SomeOutputType() = + member x.End = () + +let someFunctionWithReturnType () = + failwith "boom" + SomeOutputType() + +let test () = (someFunctionWithReturnType ()).End + +try + test () + failwith "Expected exception was not raised; the optimizer dropped the side-effectful receiver." +with +| ex when ex.Message = "boom" -> () +""" + + [] + [] + [] + let ``TaskCE_UnitMethodCall_PreservesReceiverSideEffects`` (optimize: bool) = + run optimize """ +type SomeOutputType() = + member x.Finish() = () + +let someFunctionWithReturnType () = + failwith "boom" + SomeOutputType() + +let theTaskAtHand () = + task { (someFunctionWithReturnType ()).Finish() } + +try + theTaskAtHand().Wait() + failwith "Expected exception was not raised; the optimizer dropped the side-effectful receiver." +with +| :? System.AggregateException as ex when ex.InnerException.Message = "boom" -> () +""" + + [] + [] + [] + let ``TaskCE_UnitPropertyAccess_RunsBothReceiverAndGetterEffects`` (optimize: bool) = + run optimize """ +let mutable counter = 0 + +type Tracker() = + member x.Done = counter <- counter + 1 + +let makeTracker () = + counter <- counter + 1 + Tracker() + +let theTaskAtHand () = + task { (makeTracker ()).Done } + +theTaskAtHand().Wait() +if counter <> 2 then + failwithf "Expected counter=2 (receiver + getter side effects) but got %d" counter +""" + + [] + [] + [] + let ``TaskCE_NonUnitPropertyAccess_OnSideEffectfulReceiver_Raises`` (optimize: bool) = + run optimize """ +type HasValue() = + member x.Value = 42 + +let makeHasValue () = + failwith "boom" + HasValue() + +let theTaskAtHand () = + task { let _ = (makeHasValue ()).Value in () } + +try + theTaskAtHand().Wait() + failwith "Expected exception was not raised." +with +| :? System.AggregateException as ex when ex.InnerException.Message = "boom" -> () +""" + + [] + [] + [] + let ``TaskCE_StructProjectionUnitAccess_PreservesReceiverSideEffects`` (optimize: bool) = + run optimize """ +#nowarn "52" +type Inner() = + member _.End = () + +[] +type Outer = + val Inner: Inner + new(i) = { Inner = i } + member x.GetInner = x.Inner + +let makeOuter () = + failwith "boom" + Outer(Inner()) + +let theTaskAtHand () = + task { (makeOuter()).GetInner.End } + +try + theTaskAtHand().Wait() + failwith "Expected exception was not raised; the receiver side effect was dropped." +with +| :? System.AggregateException as ex when ex.InnerException.Message = "boom" -> () +""" + + [] + [] + [] + let ``AsyncCE_UnitPropertyAccess_PreservesReceiverSideEffects`` (optimize: bool) = + run optimize """ +type SomeOutputType() = + member x.End = () + +let someFunctionWithReturnType () = + failwith "boom" + SomeOutputType() + +let theAsyncAtHand () = + async { (someFunctionWithReturnType ()).End } + +try + theAsyncAtHand () |> Async.RunSynchronously + failwith "Expected exception was not raised." +with +| ex when ex.Message = "boom" -> () +""" + + [] + [] + [] + let ``TaskCE_NestedUnitPropertyAccess_PreservesReceiverSideEffects`` (optimize: bool) = + run optimize """ +type Inner() = + member x.End = () + +type Outer() = + member x.Inner = Inner() + +let makeOuter () = + failwith "boom" + Outer() + +let theTaskAtHand () = + task { (makeOuter ()).Inner.End } + +try + theTaskAtHand().Wait() + failwith "Expected exception was not raised; the optimizer dropped the side-effectful receiver." +with +| :? System.AggregateException as ex when ex.InnerException.Message = "boom" -> () +""" From 771bd633d81e3d846ea4652e69cf700abab35fe4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:02:07 +0000 Subject: [PATCH 09/11] Reset files to feature/net11-scouting Reset patterns: - global.json - eng/Version.Details.xml - eng/Version.Details.props - eng/Versions.props - eng/common/** - eng/TargetFrameworks.props --- eng/TargetFrameworks.props | 2 +- eng/Version.Details.props | 28 +- eng/Version.Details.xml | 58 +- eng/Versions.props | 11 +- eng/common/AGENTS.md | 5 + eng/common/SetupNugetSources.ps1 | 22 +- eng/common/SetupNugetSources.sh | 22 +- eng/common/build.ps1 | 28 +- eng/common/build.sh | 38 +- .../core-templates/job/helix-job-monitor.yml | 217 +++++++ eng/common/core-templates/job/job.yml | 14 + eng/common/core-templates/job/onelocbuild.yml | 3 + .../job/publish-build-assets.yml | 12 +- eng/common/core-templates/job/renovate.yml | 196 +++++++ .../job/source-index-stage1.yml | 6 +- .../post-build/common-variables.yml | 2 - .../core-templates/post-build/post-build.yml | 528 ++++++++---------- eng/common/core-templates/stages/renovate.yml | 111 ++++ .../steps/enable-internal-sources.yml | 24 + .../steps/install-microbuild-impl.yml | 34 ++ .../steps/install-microbuild.yml | 64 ++- .../core-templates/steps/publish-logs.yml | 2 +- .../core-templates/steps/send-to-helix.yml | 22 +- .../core-templates/steps/source-build.yml | 2 +- .../steps/source-index-stage1-publish.yml | 12 +- eng/common/cross/toolchain.cmake | 3 +- eng/common/darc-init.sh | 2 +- eng/common/dotnet-install.ps1 | 6 +- eng/common/dotnet-install.sh | 8 +- eng/common/dotnet.ps1 | 1 + eng/common/dotnet.sh | 2 +- eng/common/internal-feed-operations.sh | 2 +- eng/common/msbuild.ps1 | 6 +- eng/common/msbuild.sh | 6 +- eng/common/pipeline-logging-functions.ps1 | 2 +- eng/common/post-build/redact-logs.ps1 | 3 +- eng/common/renovate.env | 42 ++ eng/common/sdk-task.ps1 | 17 +- eng/common/sdk-task.sh | 2 +- eng/common/template-guidance.md | 3 - eng/common/templates/job/job.yml | 5 - eng/common/tools.ps1 | 282 ++++------ eng/common/tools.sh | 158 +++--- global.json | 6 +- 44 files changed, 1329 insertions(+), 690 deletions(-) create mode 100644 eng/common/AGENTS.md create mode 100644 eng/common/core-templates/job/helix-job-monitor.yml create mode 100644 eng/common/core-templates/job/renovate.yml create mode 100644 eng/common/core-templates/stages/renovate.yml create mode 100644 eng/common/core-templates/steps/install-microbuild-impl.yml create mode 100644 eng/common/renovate.env diff --git a/eng/TargetFrameworks.props b/eng/TargetFrameworks.props index d384e5fbcaa..e3938d0f73a 100644 --- a/eng/TargetFrameworks.props +++ b/eng/TargetFrameworks.props @@ -11,7 +11,7 @@ - net10.0 + net11.0 $([System.Text.RegularExpressions.Regex]::Replace('$(FSharpNetCoreProductTargetFramework)', '^net(\d+)\.0$', '$1')) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index bf9ac2ce209..4b1c3d4d1e3 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,27 +6,27 @@ This file should be imported by eng/Versions.props - 10.0.0-beta.26324.4 + 11.0.0-beta.26325.1 18.10.0-preview-26353-05 18.10.0-preview-26353-05 18.10.0-preview-26353-05 18.10.0-preview-26353-05 - 1.0.0-prerelease.26318.1 - 1.0.0-prerelease.26318.1 - 1.0.0-prerelease.26318.1 - 1.0.0-prerelease.26318.1 - 1.0.0-prerelease.26318.1 + 1.0.0-prerelease.26309.1 + 1.0.0-prerelease.26309.1 + 1.0.0-prerelease.26309.1 + 1.0.0-prerelease.26309.1 + 1.0.0-prerelease.26309.1 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 + 5.10.0-1.26352.10 10.0.2 10.0.2 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3960e571dcb..69d3db657df 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,6 +1,6 @@ - + https://github.com/dotnet/msbuild @@ -18,37 +18,37 @@ https://github.com/dotnet/msbuild e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 83ca1a6465bb861e28a51cdbb4b56074b69cb5eb @@ -82,29 +82,29 @@ - + https://github.com/dotnet/arcade - 1373629deb1e04f3e8e66fb68bb48ae36479c5ef + b076228a542025c4f879f254d38adb5cf34a2475 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 06d09f3116a8ce9eed58e97ab167a3d1f4e1f151 + b5964e83d71a6fbe08ae90fd5f5a2556917d27e6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 06d09f3116a8ce9eed58e97ab167a3d1f4e1f151 + b5964e83d71a6fbe08ae90fd5f5a2556917d27e6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 06d09f3116a8ce9eed58e97ab167a3d1f4e1f151 + b5964e83d71a6fbe08ae90fd5f5a2556917d27e6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 06d09f3116a8ce9eed58e97ab167a3d1f4e1f151 + b5964e83d71a6fbe08ae90fd5f5a2556917d27e6 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 06d09f3116a8ce9eed58e97ab167a3d1f4e1f151 + b5964e83d71a6fbe08ae90fd5f5a2556917d27e6 diff --git a/eng/Versions.props b/eng/Versions.props index b224ff9b8c4..708cf2d449e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ - 7 + 6 preview$(FSharpPreReleaseIteration) 11 @@ -89,7 +89,12 @@ 4.6.1 4.6.3 6.1.2 - + + 10.0.2 + $(SystemPackagesVersion) + $(SystemPackagesVersion) + $(SystemPackagesVersion) + $(SystemPackagesVersion) @@ -156,7 +161,7 @@ 5.0.0-preview.7.20364.11 5.0.0-preview.7.20364.11 - 17.14.1 + 18.0.1 2.0.2 13.0.4 3.2.2 diff --git a/eng/common/AGENTS.md b/eng/common/AGENTS.md new file mode 100644 index 00000000000..a5ed8f72926 --- /dev/null +++ b/eng/common/AGENTS.md @@ -0,0 +1,5 @@ +# `eng/common` + +Files under `eng/common` come from [Arcade](https://github.com/dotnet/arcade). +Edits in `eng/common` will be overwritten by automation unless the changes are made directly in the Arcade repository. +For more information, see the [Arcade documentation](https://github.com/dotnet/arcade/tree/main/Documentation). diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 65ed3a8adef..58002808bc8 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -1,7 +1,6 @@ # This script adds internal feeds required to build commits that depend on internal package sources. For instance, -# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. Similarly, -# dotnet-eng-internal and dotnet-tools-internal are added if dotnet-eng and dotnet-tools are present. -# In addition, this script also enables disabled internal Maestro (darc-int*) feeds. +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. # # Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # @@ -33,6 +32,11 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +# This script only consumes helper functions from tools.ps1 to configure NuGet feeds. +# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +$disableConfigureToolsetImport = $true + . $PSScriptRoot\tools.ps1 # Adds or enables the package source with the given name @@ -174,16 +178,4 @@ foreach ($dotnetVersion in $dotnetVersions) { } } -# Check for dotnet-eng and add dotnet-eng-internal if present -$dotnetEngSource = $sources.SelectSingleNode("add[@key='dotnet-eng']") -if ($dotnetEngSource -ne $null) { - AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "dotnet-eng-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-eng-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password -} - -# Check for dotnet-tools and add dotnet-tools-internal if present -$dotnetToolsSource = $sources.SelectSingleNode("add[@key='dotnet-tools']") -if ($dotnetToolsSource -ne $null) { - AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "dotnet-tools-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password -} - $doc.Save($filename) diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b2163abbe71..67e7e0942ca 100755 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash # This script adds internal feeds required to build commits that depend on internal package sources. For instance, -# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. Similarly, -# dotnet-eng-internal and dotnet-tools-internal are added if dotnet-eng and dotnet-tools are present. -# In addition, this script also enables disabled internal Maestro (darc-int*) feeds. +# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables +# disabled internal Maestro (darc-int*) feeds. # # Optionally, this script also adds a credential entry for each of the internal feeds if supplied. # @@ -41,6 +40,11 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +# This script only consumes helper functions from tools.sh to configure NuGet feeds. +# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +disable_configure_toolset_import=1 + . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then @@ -174,18 +178,6 @@ for DotNetVersion in ${DotNetVersions[@]} ; do fi done -# Check for dotnet-eng and add dotnet-eng-internal if present -grep -i " /dev/null -if [ "$?" == "0" ]; then - AddOrEnablePackageSource "dotnet-eng-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-eng-internal/nuget/$FeedSuffix" -fi - -# Check for dotnet-tools and add dotnet-tools-internal if present -grep -i " /dev/null -if [ "$?" == "0" ]; then - AddOrEnablePackageSource "dotnet-tools-internal" "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/$FeedSuffix" -fi - # I want things split line by line PrevIFS=$IFS IFS=$'\n' diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 8cfee107e7a..2cbb725323e 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -6,6 +6,7 @@ Param( [string][Alias('v')]$verbosity = "minimal", [string] $msbuildEngine = $null, [bool] $warnAsError = $true, + [string] $warnNotAsError = '', [bool] $nodeReuse = $true, [switch] $buildCheck = $false, [switch][Alias('r')]$restore, @@ -23,6 +24,7 @@ Param( [switch][Alias('pb')]$productBuild, [switch]$fromVMR, [switch][Alias('bl')]$binaryLog, + [string][Alias('bln')]$binaryLogName = '', [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, [switch] $prepareMachine, @@ -45,6 +47,7 @@ function Print-Usage() { Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" Write-Host " -binaryLog Output binary log (short: -bl)" + Write-Host " -binaryLogName Binary log file name or path; implies -binaryLog (short: -bln)" Write-Host " -help Print help and exit" Write-Host "" @@ -70,6 +73,7 @@ function Print-Usage() { Write-Host " -excludeCIBinarylog Don't output binary log (short: -nobl)" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + Write-Host " -warnNotAsError Sets a semi-colon delimited list of warning codes that should not be treated as errors" Write-Host " -msbuildEngine Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)." Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio" Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" @@ -100,7 +104,19 @@ function Build { $toolsetBuildProj = InitializeToolset InitializeCustomToolset - $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'Build.binlog') } else { '' } + $bl = '' + if ($binaryLog) { + $binaryLogPath = if ([string]::IsNullOrEmpty($binaryLogName)) { + Join-Path $LogDir 'Build.binlog' + } elseif ([System.IO.Path]::IsPathRooted($binaryLogName)) { + $binaryLogName + } else { + Join-Path $LogDir $binaryLogName + } + + Create-Directory (Split-Path -Parent $binaryLogPath) + $bl = '/bl:' + $binaryLogPath + } $platformArg = if ($platform) { "/p:Platform=$platform" } else { '' } $check = if ($buildCheck) { '/check' } else { '' } @@ -157,7 +173,15 @@ try { if (-not $excludeCIBinarylog) { $binaryLog = $true } - $nodeReuse = $false + # Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") { + $nodeReuse = $false + } + } + + if (-not [string]::IsNullOrEmpty($binaryLogName)) { + $binaryLog = $true } if ($nativeToolsOnMachine) { diff --git a/eng/common/build.sh b/eng/common/build.sh index 9767bb411a4..3a9fdcfd0f5 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -13,6 +13,7 @@ usage() echo " --configuration Build configuration: 'Debug' or 'Release' (short: -c)" echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" echo " --binaryLog Create MSBuild binary log (short: -bl)" + echo " --binaryLogName Binary log file name or path; implies --binaryLog (short: -bln)" echo " --help Print help and exit (short: -h)" echo "" @@ -42,6 +43,7 @@ usage() echo " --prepareMachine Prepare machine for CI run, clean up processes after build" echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" + echo " --warnNotAsError Sets a semi-colon delimited list of warning codes that should not be treated as errors" echo " --buildCheck Sets /check msbuild parameter" echo " --fromVMR Set when building from within the VMR" echo "" @@ -78,11 +80,12 @@ ci=false clean=false warn_as_error=true +warn_not_as_error='' node_reuse=true build_check=false binary_log=false +binary_log_name='' exclude_ci_binary_log=false -pipelines_log=false projects='' configuration='' @@ -92,7 +95,7 @@ runtime_source_feed='' runtime_source_feed_key='' properties=() -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in -help|-h) @@ -113,12 +116,14 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; + -binarylogname|-bln) + binary_log=true + binary_log_name=$2 + shift + ;; -excludecibinarylog|-nobl) exclude_ci_binary_log=true ;; - -pipelineslog|-pl) - pipelines_log=true - ;; -restore|-r) restore=true ;; @@ -176,6 +181,10 @@ while [[ $# > 0 ]]; do warn_as_error=$2 shift ;; + -warnnotaserror) + warn_not_as_error=$2 + shift + ;; -nodereuse) node_reuse=$2 shift @@ -204,8 +213,11 @@ if [[ -z "$configuration" ]]; then fi if [[ "$ci" == true ]]; then - pipelines_log=true - node_reuse=false + # Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then + node_reuse=false + fi if [[ "$exclude_ci_binary_log" == false ]]; then binary_log=true fi @@ -231,7 +243,17 @@ function Build { local bl="" if [[ "$binary_log" == true ]]; then - bl="/bl:\"$log_dir/Build.binlog\"" + local binary_log_path="" + if [[ -z "$binary_log_name" ]]; then + binary_log_path="$log_dir/Build.binlog" + elif [[ "$binary_log_name" = /* ]]; then + binary_log_path="$binary_log_name" + else + binary_log_path="$log_dir/$binary_log_name" + fi + + mkdir -p "$(dirname "$binary_log_path")" + bl="/bl:\"$binary_log_path\"" fi local check="" diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml new file mode 100644 index 00000000000..a8162c51166 --- /dev/null +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -0,0 +1,217 @@ +parameters: +# Maximum run time of the monitor job in minutes. Also used for --max-wait-minutes. +- name: timeoutInMinutes + type: number + default: 360 + +# Owner segment of the source repository (e.g. 'dotnet' for 'dotnet/runtime') passed via --organization. +# Defaults to the owner segment of BUILD_REPOSITORY_NAME when empty. +- name: organization + type: string + default: '' + +# Name of the source repository (e.g. 'runtime' for 'dotnet/runtime') passed via --repository. +# Defaults to the repo segment of BUILD_REPOSITORY_NAME when empty. +- name: repository + type: string + default: '' + +# Optional dependency list for the generated job. +- name: dependsOn + type: object + default: [] + +# Optional condition for the generated job. +- name: condition + type: string + default: '' + +# NuGet package id of the Helix job monitor tool. +- name: toolPackageId + type: string + default: Microsoft.DotNet.Helix.JobMonitor + +# Console command exposed by the installed tool package. +- name: toolCommand + type: string + default: dotnet-helix-job-monitor + +# Optional explicit tool version. Only honored when 'toolNupkgArtifactName' is set; in the +# default code path the version is taken from the consuming repo's .config/dotnet-tools.json. +- name: toolVersion + type: string + default: '' + +# Base URI for the Helix service (--helix-base-uri). +- name: helixBaseUri + type: string + default: https://helix.dot.net/ + +# Helix API access token forwarded to the tool via the HELIX_ACCESSTOKEN environment variable. +- name: helixAccessToken + type: string + default: '' + +# Polling interval in seconds (--polling-interval-seconds). +- name: pollingIntervalSeconds + type: number + default: 30 + +# Advanced: optional pipeline artifact (produced earlier in this run) that contains the tool +# nupkg. When set, the artifact is downloaded and the tool is installed from the nupkg into +# a local tool-path; this bypasses the repo's .config/dotnet-tools.json manifest and is +# primarily intended for the Arcade repository itself, where the Helix job monitor tool is +# built in the same pipeline that runs this template. +# +# When this parameter is empty (the default), the consuming repository must declare the tool +# in its .config/dotnet-tools.json manifest (alongside other local .NET tools); the template +# will check out the repo and run 'dotnet tool restore' to install the version pinned there. +- name: toolNupkgArtifactName + type: string + default: '' + +# Advanced: sub-path within the downloaded artifact where the tool nupkg is located. Defaults +# to the standard Arcade non-shipping packages location for a Release build (relative to the +# pipeline artifact root, which is itself the build's 'artifacts' directory). +- name: toolNupkgArtifactSubPath + type: string + default: 'packages/Release/NonShipping' + +jobs: +- job: HelixJobMonitor + displayName: Monitor Helix Jobs + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + ${{ if ne(length(parameters.dependsOn), 0) }}: + dependsOn: ${{ parameters.dependsOn }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} + pool: + ${{ if eq(variables['System.TeamProject'], 'public') }}: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals build.azurelinux.3.amd64.open + ${{ else }}: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals build.azurelinux.3.amd64 + steps: + - checkout: self + fetchDepth: 1 + + - ${{ if ne(parameters.toolNupkgArtifactName, '') }}: + - task: DownloadPipelineArtifact@2 + displayName: Download Helix Job Monitor artifact + inputs: + buildType: current + artifactName: ${{ parameters.toolNupkgArtifactName }} + itemPattern: '${{ parameters.toolNupkgArtifactSubPath }}/${{ parameters.toolPackageId }}.*.nupkg' + targetPath: $(Agent.TempDirectory)/helix-job-monitor-nupkg + + - bash: | + set -euo pipefail + + toolPath="$AGENT_TEMPDIRECTORY/helix-job-monitor-tool" + mkdir -p "$toolPath" + + packageId='${{ parameters.toolPackageId }}' + toolVersion='${{ parameters.toolVersion }}' + nupkgArtifactSubPath='${{ parameters.toolNupkgArtifactSubPath }}' + nupkgDir="$AGENT_TEMPDIRECTORY/helix-job-monitor-nupkg/$nupkgArtifactSubPath" + + if [ ! -d "$nupkgDir" ]; then + echo "Expected nupkg directory '$nupkgDir' was not produced by the artifact download." >&2 + exit 1 + fi + + nupkg=$(find "$nupkgDir" -maxdepth 1 -type f -name "$packageId.*.nupkg" | head -n 1) + if [ -z "$nupkg" ]; then + echo "No '$packageId.*.nupkg' found in '$nupkgDir'." >&2 + exit 1 + fi + + # Derive the version from the nupkg filename so the local package is selected + # deterministically instead of resolving against any other configured feed. + nupkgBase=$(basename "$nupkg" .nupkg) + derivedVersion="${nupkgBase#${packageId}.}" + if [ -z "$toolVersion" ]; then + toolVersion="$derivedVersion" + fi + + echo "Using locally built '$packageId' version '$toolVersion' from '$nupkgDir'." + + # Create a minimal NuGet.config that only references the local nupkg directory. + # This avoids conflicts with the repo's package source mapping which blocks --add-source. + toolNugetConfig="$AGENT_TEMPDIRECTORY/helix-job-monitor-nuget.config" + printf '\n\n \n \n \n \n\n' "$nupkgDir" > "$toolNugetConfig" + + pushd "$(Build.SourcesDirectory)" > /dev/null + ./eng/common/dotnet.sh tool install \ + --tool-path "$toolPath" "$packageId" \ + --version "$toolVersion" \ + --configfile "$toolNugetConfig" + + # Locate the tool DLL so the run step can invoke it via ./eng/common/dotnet.sh exec. + toolDll=$(find "$toolPath/.store" -path '*/tools/*/any/*.deps.json' -type f | head -n 1) + toolDll="${toolDll%.deps.json}.dll" + if [ ! -f "$toolDll" ]; then + echo "Could not find tool DLL in '$toolPath/.store'." >&2 + exit 1 + fi + + echo "Tool DLL: $toolDll" + echo "##vso[task.setvariable variable=HelixJobMonitorDll]$toolDll" + displayName: Install Helix Job Monitor + + - ${{ else }}: + - bash: ./eng/common/dotnet.sh tool restore + displayName: Restore Helix Job Monitor + + - bash: | + set -euo pipefail + + toolArgs=( + --helix-base-uri '${{ parameters.helixBaseUri }}' + --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' + --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. + --stage-name '$(System.StageName)' + ) + + organization='${{ parameters.organization }}' + repository='${{ parameters.repository }}' + + # Fall back to Azure DevOps-provided environment variables when the caller did not + # supply organization / repository explicitly. BUILD_REPOSITORY_NAME is typically + # 'owner/repo' for GitHub-backed builds. + if [ -z "$organization" ] || [ -z "$repository" ]; then + buildRepoName="${BUILD_REPOSITORY_NAME:-}" + if [ -n "$buildRepoName" ] && [[ "$buildRepoName" == */* ]]; then + repoOwner="${buildRepoName%%/*}" + repoName="${buildRepoName#*/}" + if [ -z "$organization" ]; then organization="$repoOwner"; fi + if [ -z "$repository" ]; then repository="$repoName"; fi + fi + fi + + if [ -n "$organization" ]; then toolArgs+=( --organization "$organization" ); fi + if [ -n "$repository" ]; then toolArgs+=( --repository "$repository" ); fi + + # Build.Reason and Build.SourceBranch are required to derive the Helix source filter + # the same way the Helix SDK submitter does (PR -> 'pr', internal -> 'official', + # otherwise -> 'ci'). Without these, manually-queued / scheduled / CI builds would + # be looked up under the wrong source prefix and find zero jobs. + toolArgs+=( --build-reason "$(Build.Reason)" ) + toolArgs+=( --source-branch "$(Build.SourceBranch)" ) + + if [ -n '${{ parameters.toolNupkgArtifactName }}' ]; then + # Tool was installed from a local nupkg; run the DLL via the repo-local dotnet. + export DOTNET_ROOT="$(Build.SourcesDirectory)/.dotnet" + ./eng/common/dotnet.sh exec "$(HelixJobMonitorDll)" "${toolArgs[@]}" + else + # Tool was restored from the local .config/dotnet-tools.json manifest; invoke it + # through the manifest from the repo root. + pushd "$BUILD_SOURCESDIRECTORY" > /dev/null + trap 'popd > /dev/null' EXIT + ./eng/common/dotnet.sh tool run '${{ parameters.toolCommand }}' -- "${toolArgs[@]}" + fi + displayName: Monitor Helix Jobs + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + HELIX_ACCESSTOKEN: ${{ parameters.helixAccessToken }} diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index eaed6d87e65..cb60f529784 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -19,6 +19,8 @@ parameters: # publishing defaults artifacts: '' enableMicrobuild: false + enablePreviewMicrobuild: false + microbuildPluginVersion: 'latest' enableMicrobuildForMacAndLinux: false microbuildUseESRP: true enablePublishBuildArtifacts: false @@ -71,6 +73,14 @@ jobs: templateContext: ${{ parameters.templateContext }} variables: + - name: AllowPtrToDetectTestRunRetryFiles + value: true + # Component Governance detection and CodeQL are not run in the public project + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - name: skipComponentGovernanceDetection + value: true + - name: Codeql.SkipTaskAutoInjection + value: true - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' @@ -128,6 +138,8 @@ jobs: - template: /eng/common/core-templates/steps/install-microbuild.yml parameters: enableMicrobuild: ${{ parameters.enableMicrobuild }} + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildPluginVersion: ${{ parameters.microbuildPluginVersion }} enableMicrobuildForMacAndLinux: ${{ parameters.enableMicrobuildForMacAndLinux }} microbuildUseESRP: ${{ parameters.microbuildUseESRP }} continueOnError: ${{ parameters.continueOnError }} @@ -150,6 +162,8 @@ jobs: - template: /eng/common/core-templates/steps/cleanup-microbuild.yml parameters: enableMicrobuild: ${{ parameters.enableMicrobuild }} + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildPluginVersion: ${{ parameters.microbuildPluginVersion }} enableMicrobuildForMacAndLinux: ${{ parameters.enableMicrobuildForMacAndLinux }} continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml index eefed3b667a..86ea9f63504 100644 --- a/eng/common/core-templates/job/onelocbuild.yml +++ b/eng/common/core-templates/job/onelocbuild.yml @@ -22,6 +22,7 @@ parameters: GitHubOrg: dotnet MirrorRepo: '' MirrorBranch: main + xLocCustomPowerShellScript: '' condition: '' JobNameSuffix: '' is1ESPipeline: '' @@ -97,6 +98,8 @@ jobs: gitHubOrganization: ${{ parameters.GitHubOrg }} mirrorRepo: ${{ parameters.MirrorRepo }} mirrorBranch: ${{ parameters.MirrorBranch }} + ${{ if ne(parameters.xLocCustomPowerShellScript, '') }}: + xLocCustomPowerShellScript: ${{ parameters.xLocCustomPowerShellScript }} condition: ${{ parameters.condition }} # Copy the locProject.json to the root of the Loc directory, then publish a pipeline artifact diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index 06f2eed0323..700f7711465 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -91,8 +91,8 @@ jobs: fetchDepth: 3 clean: true - - ${{ if eq(parameters.isAssetlessBuild, 'false') }}: - - ${{ if eq(parameters.publishingVersion, 3) }}: + - ${{ if eq(parameters.isAssetlessBuild, 'false') }}: + - ${{ if eq(parameters.publishingVersion, 3) }}: - task: DownloadPipelineArtifact@2 displayName: Download Asset Manifests inputs: @@ -117,7 +117,7 @@ jobs: flattenFolders: true condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - task: NuGetAuthenticate@1 # Populate internal runtime variables. @@ -125,7 +125,7 @@ jobs: ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: parameters: legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw) - + - template: /eng/common/templates/steps/enable-internal-runtimes.yml - task: AzureCLI@2 @@ -145,7 +145,7 @@ jobs: condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - + - task: powershell@2 displayName: Create ReleaseConfigs Artifact inputs: @@ -191,7 +191,7 @@ jobs: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} is1ESPipeline: ${{ parameters.is1ESPipeline }} - + # Darc is targeting 8.0, so make sure it's installed - task: UseDotNet@2 inputs: diff --git a/eng/common/core-templates/job/renovate.yml b/eng/common/core-templates/job/renovate.yml new file mode 100644 index 00000000000..ff86c80b468 --- /dev/null +++ b/eng/common/core-templates/job/renovate.yml @@ -0,0 +1,196 @@ +# -------------------------------------------------------------------------------------- +# Renovate Bot Job Template +# -------------------------------------------------------------------------------------- +# This Azure DevOps pipeline job template runs Renovate (https://docs.renovatebot.com/) +# to automatically update dependencies in a GitHub repository. +# +# Renovate scans the repository for dependency files and creates pull requests to update +# outdated dependencies based on the configuration specified in the renovateConfigPath +# parameter. +# +# Usage: +# For each product repo wanting to make use of Renovate, this template is called from +# an internal Azure DevOps pipeline, typically with a schedule trigger, to check for +# and propose dependency updates. +# +# For more info, see https://github.com/dotnet/arcade/blob/main/Documentation/Renovate.md +# -------------------------------------------------------------------------------------- + +parameters: + +# Path to the Renovate configuration file within the repository. +- name: renovateConfigPath + type: string + default: 'eng/renovate.json' + +# GitHub repository to run Renovate against, in the format 'owner/repo'. +# This could technically be any repo but convention is to target the same +# repo that contains the calling pipeline. The Renovate config file would +# be co-located with the pipeline's repo and, in most cases, the config +# file is specific to the repo being targeted. +- name: gitHubRepo + type: string + +# List of base branches to target for Renovate PRs. +# NOTE: The Renovate configuration file is always read from the branch where the +# pipeline is run, NOT from the target branches specified here. If you need different +# configurations for different branches, run the pipeline from each branch separately. +- name: baseBranches + type: object + default: + - main + +# When true, Renovate will run in dry run mode, which previews changes without creating PRs. +# See the 'Run Renovate' step log output for details of what would have been changed. +- name: dryRun + type: boolean + default: false + +# By default, Renovate will not recreate a PR for a given dependency/version pair that was +# previously closed. This allows opting in to always recreating PRs even if they were +# previously closed. +- name: forceRecreatePR + type: boolean + default: false + +# Name of the arcade repository resource in the pipeline. +# This allows repos which haven't been onboarded to Arcade to still use this +# template by checking out the repo as a resource with a custom name and pointing +# this parameter to it. +- name: arcadeRepoResource + type: string + default: self + +# Directory name for the self repo under $(Build.SourcesDirectory) in multi-checkout. +# In multi-checkout (when arcadeRepoResource != 'self'), Azure DevOps checks out the +# self repo to $(Build.SourcesDirectory)/. Set this to match the auto-generated +# directory name. Using the auto-generated name is necessary rather than explicitly +# defining a checkout path because container jobs expect repos to live under the agent's +# workspace ($(Pipeline.Workspace)). On some self-hosted setups the host path +# (e.g., /mnt/vss/_work) differs from the container path (e.g., /__w), and a custom checkout +# path can fail validation. Using the default checkout location keeps the paths consistent +# and avoids this issue. +- name: selfRepoName + type: string + default: '' +- name: arcadeRepoName + type: string + default: '' + +# Pool configuration for the job. +- name: pool + type: object + default: + name: NetCore1ESPool-Internal + image: build.azurelinux.3.amd64 + os: linux + +jobs: +- job: Renovate + displayName: Run Renovate + container: RenovateContainer + variables: + - group: dotnet-renovate-bot + # The Renovate version is automatically updated by https://github.com/dotnet/arcade/blob/main/azure-pipelines-renovate.yml. + # Changing the variable name here would require updating the name in https://github.com/dotnet/arcade/blob/main/eng/renovate.json as well. + - name: renovateVersion + value: '42' + readonly: true + - name: renovateLogFilePath + value: '$(Build.ArtifactStagingDirectory)/renovate.json' + readonly: true + - name: dryRunArg + readonly: true + ${{ if eq(parameters.dryRun, true) }}: + value: 'full' + ${{ else }}: + value: '' + - name: recreateWhenArg + readonly: true + ${{ if eq(parameters.forceRecreatePR, true) }}: + value: 'always' + ${{ else }}: + value: '' + # In multi-checkout (without custom paths), Azure DevOps places each repo under + # $(Build.SourcesDirectory)/. selfRepoName must be provided in that case. + - name: selfRepoPath + readonly: true + ${{ if eq(parameters.arcadeRepoResource, 'self') }}: + value: '$(Build.SourcesDirectory)' + ${{ else }}: + value: '$(Build.SourcesDirectory)/${{ parameters.selfRepoName }}' + - name: arcadeRepoPath + readonly: true + ${{ if eq(parameters.arcadeRepoResource, 'self') }}: + value: '$(Build.SourcesDirectory)' + ${{ else }}: + value: '$(Build.SourcesDirectory)/${{ parameters.arcadeRepoName }}' + pool: ${{ parameters.pool }} + + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - output: pipelineArtifact + displayName: Publish Renovate Log + condition: succeededOrFailed() + targetPath: $(Build.ArtifactStagingDirectory) + artifactName: $(Agent.JobName)_Logs_Attempt$(System.JobAttempt) + isProduction: false # logs are non-production artifacts + + steps: + - checkout: self + fetchDepth: 1 + + - ${{ if ne(parameters.arcadeRepoResource, 'self') }}: + - checkout: ${{ parameters.arcadeRepoResource }} + fetchDepth: 1 + + - script: | + renovate-config-validator $(selfRepoPath)/${{parameters.renovateConfigPath}} 2>&1 | tee /tmp/renovate-config-validator.out + validatorExit=${PIPESTATUS[0]} + if grep -q '^ WARN:' /tmp/renovate-config-validator.out; then + echo "##vso[task.logissue type=warning]Renovate config validator produced warnings." + echo "##vso[task.complete result=SucceededWithIssues]" + fi + exit $validatorExit + displayName: Validate Renovate config + env: + LOG_LEVEL: info + LOG_FILE_LEVEL: debug + LOG_FILE: $(Build.ArtifactStagingDirectory)/renovate-config-validator.json + + - script: | + . $(arcadeRepoPath)/eng/common/renovate.env + renovate 2>&1 | tee /tmp/renovate.out + renovateExit=${PIPESTATUS[0]} + if grep -q '^ WARN:' /tmp/renovate.out; then + echo "##vso[task.logissue type=warning]Renovate produced warnings." + echo "##vso[task.complete result=SucceededWithIssues]" + fi + exit $renovateExit + displayName: Run Renovate + env: + RENOVATE_FORK_TOKEN: $(BotAccount-dotnet-renovate-bot-PAT) + RENOVATE_TOKEN: $(BotAccount-dotnet-renovate-bot-PAT) + RENOVATE_REPOSITORIES: ${{parameters.gitHubRepo}} + RENOVATE_BASE_BRANCHES: ${{ convertToJson(parameters.baseBranches) }} + RENOVATE_DRY_RUN: $(dryRunArg) + RENOVATE_RECREATE_WHEN: $(recreateWhenArg) + LOG_LEVEL: info + LOG_FILE_LEVEL: debug + LOG_FILE: $(renovateLogFilePath) + RENOVATE_CONFIG_FILE: $(selfRepoPath)/${{parameters.renovateConfigPath}} + + - script: | + echo "PRs created by Renovate:" + if [ -s "$(renovateLogFilePath)" ]; then + if ! jq -r 'select(.msg == "PR created" and .pr != null) | "https://github.com/\(.repository)/pull/\(.pr)"' "$(renovateLogFilePath)" | sort -u; then + echo "##vso[task.logissue type=warning]Failed to parse Renovate log file with jq." + echo "##vso[task.complete result=SucceededWithIssues]" + fi + else + echo "##vso[task.logissue type=warning]No Renovate log file found or file is empty." + echo "##vso[task.complete result=SucceededWithIssues]" + fi + displayName: List created PRs + condition: and(succeededOrFailed(), eq('${{ parameters.dryRun }}', false)) diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 76baf5c2725..bac6ac5faac 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -15,6 +15,8 @@ jobs: variables: - name: BinlogPath value: ${{ parameters.binlogPath }} + - name: skipComponentGovernanceDetection + value: true - template: /eng/common/core-templates/variables/pool-providers.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} @@ -25,10 +27,10 @@ jobs: pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: name: $(DncEngPublicBuildPool) - image: windows.vs2026preview.scout.amd64.open + image: windows.vs2026.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: windows.vs2026preview.scout.amd64 + image: windows.vs2026.amd64 steps: - ${{ if eq(parameters.is1ESPipeline, '') }}: diff --git a/eng/common/core-templates/post-build/common-variables.yml b/eng/common/core-templates/post-build/common-variables.yml index d5627a994ae..db298ae16ba 100644 --- a/eng/common/core-templates/post-build/common-variables.yml +++ b/eng/common/core-templates/post-build/common-variables.yml @@ -11,8 +11,6 @@ variables: - name: MaestroApiVersion value: "2020-02-20" - - name: SourceLinkCLIVersion - value: 3.0.0 - name: SymbolToolVersion value: 1.0.1 - name: BinlogToolVersion diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 905a6315e2d..8aa86e30491 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -1,118 +1,108 @@ parameters: - # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. - # Publishing V1 is no longer supported - # Publishing V2 is no longer supported - # Publishing V3 is the default - - name: publishingInfraVersion - displayName: Which version of publishing should be used to promote the build definition? - type: number - default: 3 - values: - - 3 - - 4 - - - name: BARBuildId - displayName: BAR Build Id - type: number - default: 0 - - - name: PromoteToChannelIds - displayName: Channel to promote BARBuildId to - type: string - default: '' - - - name: enableSourceLinkValidation - displayName: Enable SourceLink validation - type: boolean - default: false - - - name: enableSigningValidation - displayName: Enable signing validation - type: boolean - default: true - - - name: enableSymbolValidation - displayName: Enable symbol validation - type: boolean - default: false - - - name: enableNugetValidation - displayName: Enable NuGet validation - type: boolean - default: true - - - name: publishInstallersAndChecksums - displayName: Publish installers and checksums - type: boolean - default: true - - - name: requireDefaultChannels - displayName: Fail the build if there are no default channel(s) registrations for the current build - type: boolean - default: false - - - name: SDLValidationParameters - type: object - default: - enable: false - publishGdn: false - continueOnError: false - params: '' - artifactNames: '' - downloadArtifacts: true - - - name: isAssetlessBuild - type: boolean - displayName: Is Assetless Build - default: false - - # These parameters let the user customize the call to sdk-task.ps1 for publishing - # symbols & general artifacts as well as for signing validation - - name: symbolPublishingAdditionalParameters - displayName: Symbol publishing additional parameters - type: string - default: '' - - - name: artifactsPublishingAdditionalParameters - displayName: Artifact publishing additional parameters - type: string - default: '' - - - name: signingValidationAdditionalParameters - displayName: Signing validation additional parameters - type: string - default: '' - - # Which stages should finish execution before post-build stages start - - name: validateDependsOn - type: object - default: - - build - - - name: publishDependsOn - type: object - default: - - Validate - - # Optional: Call asset publishing rather than running in a separate stage - - name: publishAssetsImmediately - type: boolean - default: false - - - name: is1ESPipeline - type: boolean - default: false +# Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST. +# Publishing V1 is no longer supported +# Publishing V2 is no longer supported +# Publishing V3 is the default +- name: publishingInfraVersion + displayName: Which version of publishing should be used to promote the build definition? + type: number + default: 3 + values: + - 3 + - 4 + +- name: BARBuildId + displayName: BAR Build Id + type: number + default: 0 + +- name: PromoteToChannelIds + displayName: Channel to promote BARBuildId to + type: string + default: '' + +- name: enableSourceLinkValidation + displayName: Enable SourceLink validation + type: boolean + default: false + +- name: enableSigningValidation + displayName: Enable signing validation + type: boolean + default: true + +- name: enableSymbolValidation + displayName: Enable symbol validation + type: boolean + default: false + +- name: enableNugetValidation + displayName: Enable NuGet validation + type: boolean + default: true + +- name: publishInstallersAndChecksums + displayName: Publish installers and checksums + type: boolean + default: true + +- name: requireDefaultChannels + displayName: Fail the build if there are no default channel(s) registrations for the current build + type: boolean + default: false + +- name: isAssetlessBuild + type: boolean + displayName: Is Assetless Build + default: false + +# These parameters let the user customize the call to sdk-task.ps1 for publishing +# symbols & general artifacts as well as for signing validation +- name: symbolPublishingAdditionalParameters + displayName: Symbol publishing additional parameters + type: string + default: '' + +- name: artifactsPublishingAdditionalParameters + displayName: Artifact publishing additional parameters + type: string + default: '' + +- name: signingValidationAdditionalParameters + displayName: Signing validation additional parameters + type: string + default: '' + +# Which stages should finish execution before post-build stages start +- name: validateDependsOn + type: object + default: + - build + +- name: publishDependsOn + type: object + default: + - Validate + +# Optional: Call asset publishing rather than running in a separate stage +- name: publishAssetsImmediately + type: boolean + default: false + +- name: is1ESPipeline + type: boolean + default: false stages: -- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: +- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true')) }}: - stage: Validate dependsOn: ${{ parameters.validateDependsOn }} displayName: Validate Build Assets variables: - - template: /eng/common/core-templates/post-build/common-variables.yml - - template: /eng/common/core-templates/variables/pool-providers.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} jobs: - job: displayName: NuGet Validation @@ -128,49 +118,49 @@ stages: ${{ else }}: ${{ if eq(parameters.is1ESPipeline, true) }}: name: $(DncEngInternalBuildPool) - image: windows.vs2026preview.scout.amd64 + image: windows.vs2026.amd64 os: windows ${{ else }}: name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2026preview.scout.amd64 + demands: ImageOverride -equals windows.vs2026.amd64 steps: - - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - is1ESPipeline: ${{ parameters.is1ESPipeline }} - - - ${{ if ne(parameters.publishingInfraVersion, 4) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.publishingInfraVersion, 4) }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts (V4) - inputs: - itemPattern: '*/packages/**/*.nupkg' - targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - - task: CopyFiles@2 - displayName: Flatten packages to PackageArtifacts - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - Contents: '**/*.nupkg' - TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' - flattenFolders: true - - - task: PowerShell@2 - displayName: Validate + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} + + - ${{ if ne(parameters.publishingInfraVersion, 4) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + - ${{ if eq(parameters.publishingInfraVersion, 4) }}: + - task: DownloadPipelineArtifact@2 + displayName: Download Pipeline Artifacts (V4) + inputs: + itemPattern: '*/packages/**/*.nupkg' + targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' + - task: CopyFiles@2 + displayName: Flatten packages to PackageArtifacts inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/nuget-validation.ps1 - arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' + Contents: '**/*.nupkg' + TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' + flattenFolders: true + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ - job: displayName: Signing Validation @@ -184,143 +174,96 @@ stages: os: windows # If it's not devdiv, it's dnceng ${{ else }}: - ${{ if eq(parameters.is1ESPipeline, true) }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: name: $(DncEngInternalBuildPool) image: windows.vs2026.amd64 os: windows ${{ else }}: name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2026preview.scout.amd64 + demands: ImageOverride -equals windows.vs2026.amd64 steps: - - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - is1ESPipeline: ${{ parameters.is1ESPipeline }} - - - ${{ if ne(parameters.publishingInfraVersion, 4) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: PackageArtifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.publishingInfraVersion, 4) }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts (V4) - inputs: - itemPattern: '*/packages/**/*.nupkg' - targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - - task: CopyFiles@2 - displayName: Flatten packages to PackageArtifacts - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - Contents: '**/*.nupkg' - TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' - flattenFolders: true - - # This is necessary whenever we want to publish/restore to an AzDO private feed - # Since sdk-task.ps1 tries to restore packages we need to do this authentication here - # otherwise it'll complain about accessing a private feed. - - task: NuGetAuthenticate@1 - displayName: 'Authenticate to AzDO Feeds' - - # Signing validation will optionally work with the buildmanifest file which is downloaded from - # Azure DevOps above. - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine vs - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:SignCheckExclusionsFile='$(System.DefaultWorkingDirectory)/eng/SignCheckExclusionsFile.txt' - ${{ parameters.signingValidationAdditionalParameters }} - - - template: /eng/common/core-templates/steps/publish-logs.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} - StageLabel: 'Validation' - JobLabel: 'Signing' - BinlogToolVersion: $(BinlogToolVersion) + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} - - job: - displayName: SourceLink Validation - condition: eq( ${{ parameters.enableSourceLinkValidation }}, 'true') - pool: - # We don't use the collection uri here because it might vary (.visualstudio.com vs. dev.azure.com) - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - name: AzurePipelines-EO - image: 1ESPT-Windows2025 - demands: Cmd - os: windows - # If it's not devdiv, it's dnceng - ${{ else }}: - ${{ if eq(parameters.is1ESPipeline, true) }}: - name: $(DncEngInternalBuildPool) - image: windows.vs2026.amd64 - os: windows - ${{ else }}: - name: $(DncEngInternalBuildPool) - demands: ImageOverride -equals windows.vs2026preview.scout.amd64 - steps: - - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - is1ESPipeline: ${{ parameters.is1ESPipeline }} - - - ${{ if ne(parameters.publishingInfraVersion, 4) }}: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: specific - buildVersionToDownload: specific - project: $(AzDOProjectName) - pipeline: $(AzDOPipelineId) - buildId: $(AzDOBuildId) - artifactName: BlobArtifacts - checkDownloadedFiles: true - - ${{ if eq(parameters.publishingInfraVersion, 4) }}: - - task: DownloadPipelineArtifact@2 - displayName: Download Pipeline Artifacts (V4) - inputs: - itemPattern: '*/assets/**' - targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - - task: CopyFiles@2 - displayName: Flatten assets to BlobArtifacts - inputs: - SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' - Contents: '**/*' - TargetFolder: '$(Build.ArtifactStagingDirectory)/BlobArtifacts' - flattenFolders: true - - - task: PowerShell@2 - displayName: Validate + - ${{ if ne(parameters.publishingInfraVersion, 4) }}: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: specific + buildVersionToDownload: specific + project: $(AzDOProjectName) + pipeline: $(AzDOPipelineId) + buildId: $(AzDOBuildId) + artifactName: PackageArtifacts + checkDownloadedFiles: true + - ${{ if eq(parameters.publishingInfraVersion, 4) }}: + - task: DownloadPipelineArtifact@2 + displayName: Download Pipeline Artifacts (V4) + inputs: + itemPattern: '*/packages/**/*.nupkg' + targetPath: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' + - task: CopyFiles@2 + displayName: Flatten packages to PackageArtifacts + inputs: + SourceFolder: '$(Build.ArtifactStagingDirectory)/PipelineArtifactsDownload' + Contents: '**/*.nupkg' + TargetFolder: '$(Build.ArtifactStagingDirectory)/PackageArtifacts' + flattenFolders: true + + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@1 + displayName: 'Authenticate to AzDO Feeds' + + # Signing validation will optionally work with the buildmanifest file which is downloaded from + # Azure DevOps above. + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine dotnet + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:SignCheckExclusionsFile='$(System.DefaultWorkingDirectory)/eng/SignCheckExclusionsFile.txt' + ${{ parameters.signingValidationAdditionalParameters }} + + - template: /eng/common/core-templates/steps/publish-logs.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} + StageLabel: 'Validation' + JobLabel: 'Signing' + BinlogToolVersion: $(BinlogToolVersion) + + # SourceLink validation has been removed — the underlying CLI tool + # (targeting netcoreapp2.1) has not functioned for years. + # The enableSourceLinkValidation parameter is kept but ignored so + # existing pipelines that pass it are not broken. + # See https://github.com/dotnet/arcade/issues/16647 + - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: + - job: + displayName: 'SourceLink Validation Removed - please remove enableSourceLinkValidation from your pipeline' + pool: server + steps: + - task: Delay@1 + displayName: 'Warning: SourceLink validation removed (see https://github.com/dotnet/arcade/issues/16647)' inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - continueOnError: true + delayForMinutes: '0' - ${{ if ne(parameters.publishAssetsImmediately, 'true') }}: - stage: publish_using_darc - ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}: + ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true')) }}: dependsOn: ${{ parameters.publishDependsOn }} ${{ else }}: dependsOn: ${{ parameters.validateDependsOn }} displayName: Publish using Darc variables: - - template: /eng/common/core-templates/post-build/common-variables.yml - - template: /eng/common/core-templates/variables/pool-providers.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} + - template: /eng/common/core-templates/post-build/common-variables.yml + - template: /eng/common/core-templates/variables/pool-providers.yml + parameters: + is1ESPipeline: ${{ parameters.is1ESPipeline }} jobs: - job: displayName: Publish Using Darc @@ -334,7 +277,7 @@ stages: os: windows # If it's not devdiv, it's dnceng ${{ else }}: - ${{ if eq(parameters.is1ESPipeline, true) }}: + ${{ if eq(parameters.is1ESPipeline, true) }}: name: NetCore1ESPool-Publishing-Internal image: windows.vs2026.amd64 os: windows @@ -342,34 +285,33 @@ stages: name: NetCore1ESPool-Publishing-Internal demands: ImageOverride -equals windows.vs2026.amd64 steps: - - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml - parameters: - BARBuildId: ${{ parameters.BARBuildId }} - PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - is1ESPipeline: ${{ parameters.is1ESPipeline }} - - - task: NuGetAuthenticate@1 - - # Populate internal runtime variables. - - template: /eng/common/templates/steps/enable-internal-sources.yml - parameters: - legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw) - - - template: /eng/common/templates/steps/enable-internal-runtimes.yml + - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml + parameters: + BARBuildId: ${{ parameters.BARBuildId }} + PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} + is1ESPipeline: ${{ parameters.is1ESPipeline }} - # Darc is targeting 8.0, so make sure it's installed - - task: UseDotNet@2 - inputs: - version: 8.0.x + - task: NuGetAuthenticate@1 - - task: AzureCLI@2 - displayName: Publish Using Darc - inputs: - azureSubscription: "Darc: Maestro Production" - scriptType: ps - scriptLocation: scriptPath - scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: > + # Populate internal runtime variables. + - template: /eng/common/templates/steps/enable-internal-sources.yml + parameters: + legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw) + + - template: /eng/common/templates/steps/enable-internal-runtimes.yml + + - task: UseDotNet@2 + inputs: + version: 8.0.x + + - task: AzureCLI@2 + displayName: Publish Using Darc + inputs: + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(System.DefaultWorkingDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: > -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(System.AccessToken)' diff --git a/eng/common/core-templates/stages/renovate.yml b/eng/common/core-templates/stages/renovate.yml new file mode 100644 index 00000000000..edab2818258 --- /dev/null +++ b/eng/common/core-templates/stages/renovate.yml @@ -0,0 +1,111 @@ +# -------------------------------------------------------------------------------------- +# Renovate Pipeline Template +# -------------------------------------------------------------------------------------- +# This template provides a complete reusable pipeline definition for running Renovate +# in a 1ES Official pipeline. Pipelines can extend from this template and only need +# to pass the Renovate job parameters. +# +# For more info, see https://github.com/dotnet/arcade/blob/main/Documentation/Renovate.md +# -------------------------------------------------------------------------------------- + +parameters: + +# Path to the Renovate configuration file within the repository. +- name: renovateConfigPath + type: string + default: 'eng/renovate.json' + +# GitHub repository to run Renovate against, in the format 'owner/repo'. +- name: gitHubRepo + type: string + +# List of base branches to target for Renovate PRs. +- name: baseBranches + type: object + default: + - main + +# When true, Renovate will run in dry run mode. +- name: dryRun + type: boolean + default: false + +# When true, Renovate will recreate PRs even if they were previously closed. +- name: forceRecreatePR + type: boolean + default: false + +# Name of the arcade repository resource in the pipeline. +# This allows repos which haven't been onboarded to Arcade to still use this +# template by checking out the repo as a resource with a custom name and pointing +# this parameter to it. +- name: arcadeRepoResource + type: string + default: 'self' + +- name: selfRepoName + type: string + default: '' +- name: arcadeRepoName + type: string + default: '' + +# Pool configuration for the pipeline. +- name: pool + type: object + default: + name: NetCore1ESPool-Internal + image: build.azurelinux.3.amd64 + os: linux + +# Renovate version used in the container image tag. +- name: renovateVersion + default: 43 + type: number + +# Pool configuration for SDL analysis. +- name: sdlPool + type: object + default: + name: NetCore1ESPool-Internal + image: windows.vs2026.amd64 + os: windows + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: ${{ parameters.pool }} + sdl: + sourceAnalysisPool: ${{ parameters.sdlPool }} + # When repos that aren't onboarded to Arcade use this template, they set the + # arcadeRepoResource parameter to point to their Arcade repo resource. In that case, + # Aracde will be excluded from SDL analysis. + ${{ if ne(parameters.arcadeRepoResource, 'self') }}: + sourceRepositoriesToScan: + exclude: + - repository: ${{ parameters.arcadeRepoResource }} + containers: + RenovateContainer: + image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-renovate-${{ parameters.renovateVersion }}-amd64 + stages: + - stage: Renovate + displayName: Run Renovate + jobs: + - template: /eng/common/core-templates/job/renovate.yml@${{ parameters.arcadeRepoResource }} + parameters: + renovateConfigPath: ${{ parameters.renovateConfigPath }} + gitHubRepo: ${{ parameters.gitHubRepo }} + baseBranches: ${{ parameters.baseBranches }} + dryRun: ${{ parameters.dryRun }} + forceRecreatePR: ${{ parameters.forceRecreatePR }} + pool: ${{ parameters.pool }} + arcadeRepoResource: ${{ parameters.arcadeRepoResource }} + selfRepoName: ${{ parameters.selfRepoName }} + arcadeRepoName: ${{ parameters.arcadeRepoName }} diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 4085512b690..51af9a01709 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -15,32 +15,56 @@ steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token env: Token: ${{ parameters.legacyCredential }} + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + targetType: inline + script: | + "$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token" + env: + Token: ${{ parameters.legacyCredential }} # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config - ${{ else }}: - template: /eng/common/templates/steps/get-federated-access-token.yml parameters: federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token) # This is required in certain scenarios to install the ADO credential provider. # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others # (e.g. dotnet msbuild). diff --git a/eng/common/core-templates/steps/install-microbuild-impl.yml b/eng/common/core-templates/steps/install-microbuild-impl.yml new file mode 100644 index 00000000000..da22beb3f60 --- /dev/null +++ b/eng/common/core-templates/steps/install-microbuild-impl.yml @@ -0,0 +1,34 @@ +parameters: + - name: microbuildTaskInputs + type: object + default: {} + + - name: microbuildEnv + type: object + default: {} + + - name: enablePreviewMicrobuild + type: boolean + default: false + + - name: condition + type: string + + - name: continueOnError + type: boolean + +steps: +- ${{ if eq(parameters.enablePreviewMicrobuild, true) }}: + - task: MicroBuildSigningPluginPreview@4 + displayName: Install Preview MicroBuild plugin + inputs: ${{ parameters.microbuildTaskInputs }} + env: ${{ parameters.microbuildEnv }} + continueOnError: ${{ parameters.continueOnError }} + condition: ${{ parameters.condition }} +- ${{ else }}: + - task: MicroBuildSigningPlugin@4 + displayName: Install MicroBuild plugin + inputs: ${{ parameters.microbuildTaskInputs }} + env: ${{ parameters.microbuildEnv }} + continueOnError: ${{ parameters.continueOnError }} + condition: ${{ parameters.condition }} diff --git a/eng/common/core-templates/steps/install-microbuild.yml b/eng/common/core-templates/steps/install-microbuild.yml index 553fce66b94..76a54e157fd 100644 --- a/eng/common/core-templates/steps/install-microbuild.yml +++ b/eng/common/core-templates/steps/install-microbuild.yml @@ -4,6 +4,8 @@ parameters: # Enable install tasks for MicroBuild on Mac and Linux # Will be ignored if 'enableMicrobuild' is false or 'Agent.Os' is 'Windows_NT' enableMicrobuildForMacAndLinux: false + # Enable preview version of MB signing plugin + enablePreviewMicrobuild: false # Determines whether the ESRP service connection information should be passed to the signing plugin. # This overlaps with _SignType to some degree. We only need the service connection for real signing. # It's important that the service connection not be passed to the MicroBuildSigningPlugin task in this place. @@ -13,6 +15,8 @@ parameters: microbuildUseESRP: true # Microbuild installation directory microBuildOutputFolder: $(Agent.TempDirectory)/MicroBuild + # Microbuild version + microbuildPluginVersion: 'latest' continueOnError: false @@ -69,42 +73,46 @@ steps: # YAML expansion, and Windows vs. Linux/Mac uses different service connections. However, # we can avoid including the MB install step if not enabled at all. This avoids a bunch of # extra pipeline authorizations, since most pipelines do not sign on non-Windows. - - task: MicroBuildSigningPlugin@4 - displayName: Install MicroBuild plugin (Windows) - inputs: - signType: $(_SignType) - zipSources: false - feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - ${{ if eq(parameters.microbuildUseESRP, true) }}: - ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)' - ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea - ${{ else }}: - ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca - env: - TeamName: $(_TeamName) - MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'), in(variables['_SignType'], 'real', 'test')) - - - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, true) }}: - - task: MicroBuildSigningPlugin@4 - displayName: Install MicroBuild plugin (non-Windows) - inputs: + - template: /eng/common/core-templates/steps/install-microbuild-impl.yml + parameters: + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildTaskInputs: signType: $(_SignType) zipSources: false feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json - workingDirectory: ${{ parameters.microBuildOutputFolder }} + version: ${{ parameters.microbuildPluginVersion }} ${{ if eq(parameters.microbuildUseESRP, true) }}: ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)' ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: - ConnectedPMEServiceName: beb8cb23-b303-4c95-ab26-9e44bc958d39 + ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea ${{ else }}: - ConnectedPMEServiceName: c24de2a5-cc7a-493d-95e4-8e5ff5cad2bc - env: + ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca + microbuildEnv: TeamName: $(_TeamName) MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} SYSTEM_ACCESSTOKEN: $(System.AccessToken) continueOnError: ${{ parameters.continueOnError }} - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'), eq(variables['_SignType'], 'real')) + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'), in(variables['_SignType'], 'real', 'test')) + + - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, true) }}: + - template: /eng/common/core-templates/steps/install-microbuild-impl.yml + parameters: + enablePreviewMicrobuild: ${{ parameters.enablePreviewMicrobuild }} + microbuildTaskInputs: + signType: $(_SignType) + zipSources: false + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json + version: ${{ parameters.microbuildPluginVersion }} + workingDirectory: ${{ parameters.microBuildOutputFolder }} + ${{ if eq(parameters.microbuildUseESRP, true) }}: + ConnectedServiceName: 'MicroBuild Signing Task (DevDiv)' + ${{ if eq(variables['System.TeamProject'], 'DevDiv') }}: + ConnectedPMEServiceName: beb8cb23-b303-4c95-ab26-9e44bc958d39 + ${{ else }}: + ConnectedPMEServiceName: c24de2a5-cc7a-493d-95e4-8e5ff5cad2bc + microbuildEnv: + TeamName: $(_TeamName) + MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'), eq(variables['_SignType'], 'real')) diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml index 694f55a926e..2731e48cce4 100644 --- a/eng/common/core-templates/steps/publish-logs.yml +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -33,7 +33,6 @@ steps: '$(publishing-dnceng-devdiv-code-r-build-re)' '$(dn-bot-all-orgs-artifact-feeds-rw)' '$(akams-client-id)' - '$(dn-bot-all-orgs-build-rw-code-rw)' '$(System.AccessToken)' ${{parameters.CustomSensitiveDataList}} continueOnError: true @@ -58,3 +57,4 @@ steps: condition: always() retryCountOnTaskFailure: 10 # for any files being locked isProduction: false # logs are non-production artifacts + diff --git a/eng/common/core-templates/steps/send-to-helix.yml b/eng/common/core-templates/steps/send-to-helix.yml index 68fa739c4ab..ec7a2000399 100644 --- a/eng/common/core-templates/steps/send-to-helix.yml +++ b/eng/common/core-templates/steps/send-to-helix.yml @@ -10,6 +10,7 @@ parameters: HelixConfiguration: '' # optional -- additional property attached to a job HelixPreCommands: '' # optional -- commands to run before Helix work item execution HelixPostCommands: '' # optional -- commands to run after Helix work item execution + UseHelixMonitor: false # optional -- true will submit Helix jobs configured for the standalone Helix Job Monitor (results are reported/waited on out-of-band; this step will not wait, and WaitForWorkItemCompletion will be overridden) WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects WorkItemCommand: '' # optional -- a command to execute on the payload; requires WorkItemDirectory; incompatible with XUnitProjects WorkItemTimeout: '' # optional -- a timeout in TimeSpan.Parse-ready value (e.g. 00:02:00) for the work item command; requires WorkItemDirectory; incompatible with XUnitProjects @@ -31,7 +32,15 @@ parameters: continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false steps: - - powershell: 'powershell "$env:BUILD_SOURCESDIRECTORY\eng\common\msbuild.ps1 $env:BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$env:BUILD_SOURCESDIRECTORY\artifacts\log\$env:BuildConfig\SendToHelix.binlog"' + - powershell: > + $(Build.SourcesDirectory)\eng\common\msbuild.ps1 + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} + /restore + /p:TreatWarningsAsErrors=false + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} + ${{ parameters.HelixProjectArguments }} + /t:Test + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog displayName: ${{ parameters.DisplayNamePrefix }} (Windows) env: BuildConfig: $(_BuildConfig) @@ -61,7 +70,15 @@ steps: SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} - - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/${{ parameters.HelixProjectPath }} /restore /p:TreatWarningsAsErrors=false ${{ parameters.HelixProjectArguments }} /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + - script: > + $(Build.SourcesDirectory)/eng/common/msbuild.sh + $(Build.SourcesDirectory)/${{ parameters.HelixProjectPath }} + /restore + /p:TreatWarningsAsErrors=false + /p:EnableHelixJobMonitor=${{ parameters.UseHelixMonitor }} + ${{ parameters.HelixProjectArguments }} + /t:Test + /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog displayName: ${{ parameters.DisplayNamePrefix }} (Unix) env: BuildConfig: $(_BuildConfig) @@ -91,3 +108,4 @@ steps: SYSTEM_ACCESSTOKEN: $(System.AccessToken) condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) continueOnError: ${{ parameters.continueOnError }} + diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index 09ae5cd73ae..b75f59c428d 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -24,7 +24,7 @@ steps: # in the default public locations. internalRuntimeDownloadArgs= if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then - internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://ci.dot.net/internal --runtimesourcefeedkey '$(dotnetbuilds-internal-container-read-token-base64)'' + internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://ci.dot.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://ci.dot.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)' fi buildConfig=Release diff --git a/eng/common/core-templates/steps/source-index-stage1-publish.yml b/eng/common/core-templates/steps/source-index-stage1-publish.yml index 6e7666b4dcf..fdca622357f 100644 --- a/eng/common/core-templates/steps/source-index-stage1-publish.yml +++ b/eng/common/core-templates/steps/source-index-stage1-publish.yml @@ -1,21 +1,21 @@ parameters: - sourceIndexUploadPackageVersion: 2.0.0-20250818.1 - sourceIndexProcessBinlogPackageVersion: 1.0.1-20250818.1 + sourceIndexUploadPackageVersion: 2.0.0-20260521.2 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20260521.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json binlogPath: artifacts/log/Debug/Build.binlog steps: - task: UseDotNet@2 - displayName: "Source Index: Use .NET 9 SDK" + displayName: "Source Index: Use .NET 10 SDK" inputs: packageType: sdk - version: 9.0.x + version: 10.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version ${{parameters.sourceIndexProcessBinlogPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version ${{parameters.sourceIndexUploadPackageVersion}} --source ${{parameters.SourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version ${{parameters.sourceIndexProcessBinlogPackageVersion}} --source ${{parameters.sourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version ${{parameters.sourceIndexUploadPackageVersion}} --source ${{parameters.sourceIndexPackageSource}} --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: "Source Index: Download netsourceindex Tools" # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. workingDirectory: $(Agent.TempDirectory) diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index f65c689f695..ead7fe3ef26 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -159,6 +159,7 @@ if(TIZEN) else() find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}") endif() + include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++) include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN}) endif() @@ -226,7 +227,7 @@ elseif(HAIKU) set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") - if ("$ENV{CCC_CC}" MATCHES ".*gcc.*") + if ($ENV{CCC_CC} MATCHES ".*gcc.*") set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") locate_toolchain_exec(gcc CMAKE_C_COMPILER) locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index e6ba4ee28c1..b56d40e5706 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -5,7 +5,7 @@ darcVersion='' versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' verbosity='minimal' -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in --darcversion) diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 index 811f0f717f7..50ae6273768 100644 --- a/eng/common/dotnet-install.ps1 +++ b/eng/common/dotnet-install.ps1 @@ -10,7 +10,11 @@ Param( . $PSScriptRoot\tools.ps1 -$dotnetRoot = Join-Path $RepoRoot '.dotnet' +if (-not [string]::IsNullOrEmpty($env:DOTNET_GLOBAL_INSTALL_DIR)) { + $dotnetRoot = $env:DOTNET_GLOBAL_INSTALL_DIR +} else { + $dotnetRoot = Join-Path $RepoRoot '.dotnet' +} $installdir = $dotnetRoot try { diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index 7b9d97e3bd4..1cb3f5abac2 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -18,7 +18,7 @@ architecture='' runtime='dotnet' runtimeSourceFeed='' runtimeSourceFeedKey='' -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in -version|-v) @@ -80,7 +80,11 @@ case $cpuname in ;; esac -dotnetRoot="${repo_root}.dotnet" +if [[ -n "${DOTNET_GLOBAL_INSTALL_DIR:-}" ]]; then + dotnetRoot="$DOTNET_GLOBAL_INSTALL_DIR" +else + dotnetRoot="${repo_root}.dotnet" +fi if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then dotnetRoot="$dotnetRoot/$architecture" fi diff --git a/eng/common/dotnet.ps1 b/eng/common/dotnet.ps1 index 45e5676c9eb..ce4ea40730a 100755 --- a/eng/common/dotnet.ps1 +++ b/eng/common/dotnet.ps1 @@ -8,4 +8,5 @@ $dotnetRoot = InitializeDotNetCli -install:$true if ($args.count -gt 0) { $env:DOTNET_NOLOGO=1 & "$dotnetRoot\dotnet.exe" $args + ExitWithExitCode $LASTEXITCODE } diff --git a/eng/common/dotnet.sh b/eng/common/dotnet.sh index 2ef68235675..f6d24871c1d 100755 --- a/eng/common/dotnet.sh +++ b/eng/common/dotnet.sh @@ -19,7 +19,7 @@ source $scriptroot/tools.sh InitializeDotNetCli true # install # Invoke acquired SDK with args if they are provided -if [[ $# > 0 ]]; then +if [[ $# -gt 0 ]]; then __dotnetDir=${_InitializeDotNetCli} dotnetPath=${__dotnetDir}/dotnet ${dotnetPath} "$@" diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh index 9378223ba09..6299e7effd4 100755 --- a/eng/common/internal-feed-operations.sh +++ b/eng/common/internal-feed-operations.sh @@ -100,7 +100,7 @@ operation='' authToken='' repoName='' -while [[ $# > 0 ]]; do +while [[ $# -gt 0 ]]; do opt="$(echo "$1" | tr "[:upper:]" "[:lower:]")" case "$opt" in --operation) diff --git a/eng/common/msbuild.ps1 b/eng/common/msbuild.ps1 index f041e5ddd95..495d533a909 100644 --- a/eng/common/msbuild.ps1 +++ b/eng/common/msbuild.ps1 @@ -14,7 +14,11 @@ Param( try { if ($ci) { - $nodeReuse = $false + # Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if ($env:MSBUILD_NODEREUSE_ENABLED -ne "1") { + $nodeReuse = $false + } } MSBuild @extraArgs diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh index 20d3dad5435..333be3232fc 100755 --- a/eng/common/msbuild.sh +++ b/eng/common/msbuild.sh @@ -51,7 +51,11 @@ done . "$scriptroot/tools.sh" if [[ "$ci" == true ]]; then - node_reuse=false + # Disable node reuse on CI unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if [[ "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then + node_reuse=false + fi fi MSBuild $extra_args diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 8e422c561e4..9f85c291708 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -32,7 +32,7 @@ function Write-PipelineTelemetryError { $PSBoundParameters.Remove('Category') | Out-Null if ($Force -Or ((Test-Path variable:ci) -And $ci)) { - $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" + $Message = "($Category) $Message" } $PSBoundParameters.Remove('Message') | Out-Null $PSBoundParameters.Add('Message', $Message) diff --git a/eng/common/post-build/redact-logs.ps1 b/eng/common/post-build/redact-logs.ps1 index c1e4104b79a..672f4e2652e 100644 --- a/eng/common/post-build/redact-logs.ps1 +++ b/eng/common/post-build/redact-logs.ps1 @@ -9,7 +9,8 @@ param( [Parameter(Mandatory=$false)][string] $TokensFilePath, [Parameter(ValueFromRemainingArguments=$true)][String[]]$TokensToRedact, [Parameter(Mandatory=$false)][string] $runtimeSourceFeed, - [Parameter(Mandatory=$false)][string] $runtimeSourceFeedKey) + [Parameter(Mandatory=$false)][string] $runtimeSourceFeedKey +) try { $ErrorActionPreference = 'Stop' diff --git a/eng/common/renovate.env b/eng/common/renovate.env new file mode 100644 index 00000000000..17ecc05d9b1 --- /dev/null +++ b/eng/common/renovate.env @@ -0,0 +1,42 @@ +# Renovate Global Configuration +# https://docs.renovatebot.com/self-hosted-configuration/ +# +# NOTE: This file uses bash/shell format and is sourced via `. renovate.env`. +# Values containing spaces or special characters must be quoted. + +# Author to use for git commits made by Renovate +# https://docs.renovatebot.com/configuration-options/#gitauthor +export RENOVATE_GIT_AUTHOR='.NET Renovate ' + +# Disable rate limiting for PR creation (0 = unlimited) +# https://docs.renovatebot.com/presets-default/#prhourlylimitnone +# https://docs.renovatebot.com/presets-default/#prconcurrentlimitnone +export RENOVATE_PR_HOURLY_LIMIT=0 +export RENOVATE_PR_CONCURRENT_LIMIT=0 + +# Skip the onboarding PR that Renovate normally creates for new repos +# https://docs.renovatebot.com/config-overview/#onboarding +export RENOVATE_ONBOARDING=false + +# Any Renovate config file in the cloned repository is ignored. Only +# the Renovate config file from the repo where the pipeline is running +# is used (yes, those are the same repo but the sources may be different). +# https://docs.renovatebot.com/self-hosted-configuration/#requireconfig +export RENOVATE_REQUIRE_CONFIG=ignored + +# Customize the PR body content. This removes some of the default +# sections that aren't relevant in a self-hosted config. +# https://docs.renovatebot.com/configuration-options/#prheader +# https://docs.renovatebot.com/configuration-options/#prbodynotes +# https://docs.renovatebot.com/configuration-options/#prbodytemplate +export RENOVATE_PR_HEADER='## Automated Dependency Update' +export RENOVATE_PR_BODY_NOTES='["This PR has been created automatically by the [.NET Renovate Bot](https://github.com/dotnet/arcade/blob/main/Documentation/Renovate.md) to update one or more dependencies in your repo. Please review the changes and merge the PR if everything looks good."]' +export RENOVATE_PR_BODY_TEMPLATE='{{{header}}}{{{table}}}{{{warnings}}}{{{notes}}}{{{changelogs}}}' + +# Extend the global config with additional presets +# https://docs.renovatebot.com/self-hosted-configuration/#globalextends +# Disable the Dependency Dashboard issue that tracks all updates +export RENOVATE_GLOBAL_EXTENDS='[":disableDependencyDashboard"]' + +# Allow all commands for post-upgrade commands. +export RENOVATE_ALLOWED_COMMANDS='[".*"]' diff --git a/eng/common/sdk-task.ps1 b/eng/common/sdk-task.ps1 index b64b66a6275..68119de603e 100644 --- a/eng/common/sdk-task.ps1 +++ b/eng/common/sdk-task.ps1 @@ -22,7 +22,7 @@ $warnAsError = if ($noWarnAsError) { $false } else { $true } function Print-Usage() { Write-Host "Common settings:" - Write-Host " -task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + Write-Host " -task Name of Arcade task (name of a project in toolset directory of the Arcade SDK package)" Write-Host " -restore Restore dependencies" Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" Write-Host " -help Print help and exit" @@ -66,20 +66,7 @@ try { if( $msbuildEngine -eq "vs") { # Ensure desktop MSBuild is available for sdk tasks. - if( -not ($GlobalJson.tools.PSObject.Properties.Name -contains "vs" )) { - $GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty - } - if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) { - $GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "18.0.0" -MemberType NoteProperty - } - if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") { - $xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true - } - if ($xcopyMSBuildToolsFolder -eq $null) { - throw 'Unable to get xcopy downloadable version of msbuild' - } - - $global:_MSBuildExe = "$($xcopyMSBuildToolsFolder)\MSBuild\Current\Bin\MSBuild.exe" + $global:_MSBuildExe = InitializeVisualStudioMSBuild } $taskProject = GetSdkTaskProject $task diff --git a/eng/common/sdk-task.sh b/eng/common/sdk-task.sh index 3270f83fa9a..1cf71bb2aea 100644 --- a/eng/common/sdk-task.sh +++ b/eng/common/sdk-task.sh @@ -2,7 +2,7 @@ show_usage() { echo "Common settings:" - echo " --task Name of Arcade task (name of a project in SdkTasks directory of the Arcade SDK package)" + echo " --task Name of Arcade task (name of a project in toolset directory of the Arcade SDK package)" echo " --restore Restore dependencies" echo " --verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" echo " --help Print help and exit" diff --git a/eng/common/template-guidance.md b/eng/common/template-guidance.md index e2b07a865f1..f772aa3d78f 100644 --- a/eng/common/template-guidance.md +++ b/eng/common/template-guidance.md @@ -71,7 +71,6 @@ eng\common\ source-build.yml (shim) source-index-stage1.yml (shim) jobs\ - codeql-build.yml (shim) jobs.yml (shim) source-build.yml (shim) post-build\ @@ -88,7 +87,6 @@ eng\common\ source-build.yml (shim) variables\ pool-providers.yml (logic + redirect) # templates/variables/pool-providers.yml will redirect to templates-official/variables/pool-providers.yml if you are running in the internal project - sdl-variables.yml (logic) core-templates\ job\ job.yml (logic) @@ -97,7 +95,6 @@ eng\common\ source-build.yml (logic) source-index-stage1.yml (logic) jobs\ - codeql-build.yml (logic) jobs.yml (logic) source-build.yml (logic) post-build\ diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 5e261f34db4..85501406a54 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -21,11 +21,6 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} - # we don't run CG in public - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable - artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 977a2d4b103..de32a6da377 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -13,12 +13,6 @@ # Set to true to output binary log from msbuild. Note that emitting binary log slows down the build. [bool]$binaryLog = if (Test-Path variable:binaryLog) { $binaryLog } else { $ci -and !$excludeCIBinarylog } -# Set to true to use the pipelines logger which will enable Azure logging output. -# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md -# This flag is meant as a temporary opt-opt for the feature while validate it across -# our consumers. It will be deleted in the future. -[bool]$pipelinesLog = if (Test-Path variable:pipelinesLog) { $pipelinesLog } else { $ci } - # Turns on machine preparation/clean up code that changes the machine state (e.g. kills build processes). [bool]$prepareMachine = if (Test-Path variable:prepareMachine) { $prepareMachine } else { $false } @@ -34,6 +28,9 @@ # Configures warning treatment in msbuild. [bool]$warnAsError = if (Test-Path variable:warnAsError) { $warnAsError } else { $true } +# Specifies semi-colon delimited list of warning codes that should not be treated as errors. +[string]$warnNotAsError = if (Test-Path variable:warnNotAsError) { $warnNotAsError } else { '' } + # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). [string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } @@ -157,9 +154,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { return $global:_DotNetInstallDir } - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - $env:DOTNET_MULTILEVEL_LOOKUP=0 - # Disable first run since we do not need all ASP.NET packages restored. $env:DOTNET_NOLOGO=1 @@ -185,7 +179,11 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { if ((-not $globalJsonHasRuntimes) -and (-not [string]::IsNullOrEmpty($env:DOTNET_INSTALL_DIR)) -and (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { $dotnetRoot = $env:DOTNET_INSTALL_DIR } else { - $dotnetRoot = Join-Path $RepoRoot '.dotnet' + if (-not [string]::IsNullOrEmpty($env:DOTNET_GLOBAL_INSTALL_DIR)) { + $dotnetRoot = $env:DOTNET_GLOBAL_INSTALL_DIR + } else { + $dotnetRoot = Join-Path $RepoRoot '.dotnet' + } if (-not (Test-Path(Join-Path $dotnetRoot "sdk\$dotnetSdkVersion"))) { if ($install) { @@ -225,7 +223,6 @@ function InitializeDotNetCli([bool]$install, [bool]$createSdkLocationFile) { # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build Write-PipelinePrependPath -Path $dotnetRoot - Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' Write-PipelineSetVariable -Name 'DOTNET_NOLOGO' -Value '1' return $global:_DotNetInstallDir = $dotnetRoot @@ -299,6 +296,8 @@ function InstallDotNet([string] $dotnetRoot, $dotnetVersionLabel = "'sdk v$version'" + # For performance this check is duplicated in src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs + # if you are making changes here, consider if you need to make changes there as well. if ($runtime -ne '' -and $runtime -ne 'sdk') { $runtimePath = $dotnetRoot $runtimePath = $runtimePath + "\shared" @@ -374,12 +373,11 @@ function InstallDotNet([string] $dotnetRoot, # # 1. MSBuild from an active VS command prompt # 2. MSBuild from a compatible VS installation -# 3. MSBuild from the xcopy tool package # # Returns full path to msbuild.exe. # Throws on failure. # -function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = $null) { +function InitializeVisualStudioMSBuild([object]$vsRequirements = $null) { if (-not (IsWindowsPlatform)) { throw "Cannot initialize Visual Studio on non-Windows" } @@ -389,13 +387,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } # Minimum VS version to require. - $vsMinVersionReqdStr = '17.7' - $vsMinVersionReqd = [Version]::new($vsMinVersionReqdStr) - - # If the version of msbuild is going to be xcopied, - # use this version. Version matches a package here: - # https://dev.azure.com/dnceng/public/_artifacts/feed/dotnet-eng/NuGet/Microsoft.DotNet.Arcade.MSBuild.Xcopy/versions/18.0.0 - $defaultXCopyMSBuildVersion = '18.0.0' + $vsMinVersionReqdStr = '18.0' if (!$vsRequirements) { if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') { @@ -425,46 +417,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = } } - # Locate Visual Studio installation or download x-copy msbuild. + # Locate Visual Studio installation. $vsInfo = LocateVisualStudio $vsRequirements - if ($vsInfo -ne $null -and $env:ForceUseXCopyMSBuild -eq $null) { + if ($vsInfo -ne $null) { # Ensure vsInstallDir has a trailing slash $vsInstallDir = Join-Path $vsInfo.installationPath "\" $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] InitializeVisualStudioEnvironmentVariables $vsInstallDir $vsMajorVersion } else { - if (Get-Member -InputObject $GlobalJson.tools -Name 'xcopy-msbuild') { - $xcopyMSBuildVersion = $GlobalJson.tools.'xcopy-msbuild' - $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] - } else { - #if vs version provided in global.json is incompatible (too low) then use the default version for xcopy msbuild download - if($vsMinVersion -lt $vsMinVersionReqd){ - Write-Host "Using xcopy-msbuild version of $defaultXCopyMSBuildVersion since VS version $vsMinVersionStr provided in global.json is not compatible" - $xcopyMSBuildVersion = $defaultXCopyMSBuildVersion - $vsMajorVersion = $xcopyMSBuildVersion.Split('.')[0] - } - else{ - # If the VS version IS compatible, look for an xcopy msbuild package - # with a version matching VS. - # Note: If this version does not exist, then an explicit version of xcopy msbuild - # can be specified in global.json. This will be required for pre-release versions of msbuild. - $vsMajorVersion = $vsMinVersion.Major - $vsMinorVersion = $vsMinVersion.Minor - $xcopyMSBuildVersion = "$vsMajorVersion.$vsMinorVersion.0" - } - } - - $vsInstallDir = $null - if ($xcopyMSBuildVersion.Trim() -ine "none") { - $vsInstallDir = InitializeXCopyMSBuild $xcopyMSBuildVersion $install - if ($vsInstallDir -eq $null) { - throw "Could not xcopy msbuild. Please check that package 'Microsoft.DotNet.Arcade.MSBuild.Xcopy @ $xcopyMSBuildVersion' exists on feed 'dotnet-eng'." - } - } - if ($vsInstallDir -eq $null) { - throw 'Unable to find Visual Studio that has required version and components installed' - } + throw 'Unable to find Visual Studio that has required version and components installed' } $msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" } @@ -491,38 +453,6 @@ function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [str } } -function InstallXCopyMSBuild([string]$packageVersion) { - return InitializeXCopyMSBuild $packageVersion -install $true -} - -function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { - $packageName = 'Microsoft.DotNet.Arcade.MSBuild.Xcopy' - $packageDir = Join-Path $ToolsDir "msbuild\$packageVersion" - $packagePath = Join-Path $packageDir "$packageName.$packageVersion.nupkg" - - if (!(Test-Path $packageDir)) { - if (!$install) { - return $null - } - - Create-Directory $packageDir - - Write-Host "Downloading $packageName $packageVersion" - $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit - Retry({ - Invoke-WebRequest "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/flat2/$packageName/$packageVersion/$packageName.$packageVersion.nupkg" -UseBasicParsing -OutFile $packagePath - }) - - if (!(Test-Path $packagePath)) { - Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "See https://dev.azure.com/dnceng/internal/_wiki/wikis/DNCEng%20Services%20Wiki/1074/Updating-Microsoft.DotNet.Arcade.MSBuild.Xcopy-WAS-RoslynTools.MSBuild-(xcopy-msbuild)-generation?anchor=troubleshooting for help troubleshooting issues with XCopy MSBuild" - throw - } - Unzip $packagePath $packageDir - } - - return Join-Path $packageDir 'tools' -} - # # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. # @@ -544,7 +474,6 @@ function LocateVisualStudio([object]$vsRequirements = $null){ if (Get-Member -InputObject $GlobalJson.tools -Name 'vswhere') { $vswhereVersion = $GlobalJson.tools.vswhere } else { - # keep this in sync with the VSWhereVersion in DefaultVersions.props $vswhereVersion = '3.1.7' } @@ -592,6 +521,11 @@ function LocateVisualStudio([object]$vsRequirements = $null){ return $null } + if ($null -eq $vsInfo -or $vsInfo.Count -eq 0) { + throw "No instance of Visual Studio meeting the requirements specified was found. Requirements: $($args -join ' ')" + return $null + } + # use first matching instance return $vsInfo[0] } @@ -627,7 +561,7 @@ function InitializeBuildTool() { $buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net' } } elseif ($msbuildEngine -eq "vs") { try { - $msbuildPath = InitializeVisualStudioMSBuild -install:$restore + $msbuildPath = InitializeVisualStudioMSBuild } catch { Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ ExitWithExitCode 1 @@ -656,16 +590,16 @@ function GetDefaultMSBuildEngine() { ExitWithExitCode 1 } -function GetNuGetPackageCachePath() { +function InitializeNuGetPackageCachePath() { if ($env:NUGET_PACKAGES -eq $null) { # Use local cache on CI to ensure deterministic build. - # Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116 # use global cache in dev builds to avoid cost of downloading packages. # For directory normalization, see also: https://github.com/NuGet/Home/issues/7968 if ($useGlobalNuGetCache) { - $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' + $userProfile = if (IsWindowsPlatform) { $env:UserProfile } else { $env:HOME } + $env:NUGET_PACKAGES = [IO.Path]::Combine($userProfile, '.nuget', 'packages') + [IO.Path]::DirectorySeparatorChar } else { - $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' + $env:NUGET_PACKAGES = [IO.Path]::Combine($RepoRoot, '.packages') + [IO.Path]::DirectorySeparatorChar } } @@ -674,7 +608,13 @@ function GetNuGetPackageCachePath() { # Returns a full path to an Arcade SDK task project file. function GetSdkTaskProject([string]$taskName) { - return Join-Path (Split-Path (InitializeToolset) -Parent) "SdkTasks\$taskName.proj" + $toolsetDir = Split-Path (InitializeToolset) -Parent + $proj = Join-Path $toolsetDir "$taskName.proj" + if (Test-Path $proj) { + return $proj + } + + throw "Unable to find $taskName.proj in toolset at: $toolsetDir" } function InitializeNativeTools() { @@ -708,16 +648,19 @@ function InitializeToolset() { return $global:_InitializeToolset } - $nugetCache = GetNuGetPackageCachePath - $toolsetVersion = Read-ArcadeSdkVersion - $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" + $toolsetToolsDir = Join-Path $ToolsetDir $toolsetVersion - if (Test-Path $toolsetLocationFile) { - $path = Get-Content $toolsetLocationFile -TotalCount 1 - if (Test-Path $path) { - return $global:_InitializeToolset = $path - } + # Check if the toolset has already been extracted + $toolsetBuildProj = $null + $buildProjPath = Join-Path $toolsetToolsDir 'Build.proj' + + if (Test-Path $buildProjPath) { + $toolsetBuildProj = $buildProjPath + } + + if ($toolsetBuildProj -ne $null) { + return $global:_InitializeToolset = $toolsetBuildProj } if (-not $restore) { @@ -725,21 +668,41 @@ function InitializeToolset() { ExitWithExitCode 1 } - $buildTool = InitializeBuildTool + $downloadArgs = @("package", "download", "Microsoft.DotNet.Arcade.Sdk@$toolsetVersion", "--verbosity", "minimal", "--prerelease", "--output", "$nugetPackageCachePath") + $nugetConfig = $env:NUGET_CONFIG + if (-not $nugetConfig) { + # Search for any variation of nuget.config in the RepoRoot + $configFile = Get-ChildItem -Path $RepoRoot -File | Where-Object { $_.Name -ieq "nuget.config" } | Select-Object -First 1 + + if ($configFile) { + $nugetConfig = $configFile.FullName + } + } + + if ($nugetConfig) { + $downloadArgs += "--configfile" + $downloadArgs += $nugetConfig + } + DotNet @downloadArgs - $proj = Join-Path $ToolsetDir 'restore.proj' - $bl = if ($binaryLog) { '/bl:' + (Join-Path $LogDir 'ToolsetRestore.binlog') } else { '' } + $packageDir = Join-Path $nugetPackageCachePath (Join-Path 'microsoft.dotnet.arcade.sdk' $toolsetVersion) + $packageToolsetDir = Join-Path $packageDir 'toolset' - '' | Set-Content $proj + if (!(Test-Path $packageToolsetDir)) { + Write-PipelineTelemetryError -Category 'InitializeToolset' -Message "Arcade SDK package does not contain a toolset or tools folder: $packageDir" + ExitWithExitCode 3 + } - MSBuild-Core $proj $bl /t:__WriteToolsetLocation /clp:ErrorsOnly`;NoSummary /p:__ToolsetLocationOutputFile=$toolsetLocationFile + New-Item -ItemType Directory -Path $toolsetToolsDir -Force | Out-Null + Copy-Item -Path "$packageToolsetDir\*" -Destination $toolsetToolsDir -Recurse -Force - $path = Get-Content $toolsetLocationFile -Encoding UTF8 -TotalCount 1 - if (!(Test-Path $path)) { - throw "Invalid toolset path: $path" + if (Test-Path $buildProjPath) { + $toolsetBuildProj = $buildProjPath + } else { + throw "Unable to find Build.proj in toolset at: $toolsetToolsDir" } - return $global:_InitializeToolset = $path + return $global:_InitializeToolset = $toolsetBuildProj } function ExitWithExitCode([int] $exitCode) { @@ -773,53 +736,20 @@ function Stop-Processes() { # Terminates the script if the build fails. # function MSBuild() { - if ($pipelinesLog) { - $buildTool = InitializeBuildTool - - if ($ci -and $buildTool.Tool -eq 'dotnet') { - $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 - $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' - } - - Enable-Nuget-EnhancedRetry - - $toolsetBuildProject = InitializeToolset - $basePath = Split-Path -parent $toolsetBuildProject - $selectedPath = Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll') - - if (-not $selectedPath) { - Write-PipelineTelemetryError -Category 'Build' -Message "Unable to find arcade sdk logger assembly: $selectedPath" - ExitWithExitCode 1 - } - - $args += "/logger:$selectedPath" - } - - MSBuild-Core @args -} - -# -# Executes msbuild (or 'dotnet msbuild') with arguments passed to the function. -# The arguments are automatically quoted. -# Terminates the script if the build fails. -# -function MSBuild-Core() { if ($ci) { if (!$binaryLog -and !$excludeCIBinarylog) { Write-PipelineTelemetryError -Category 'Build' -Message 'Binary log must be enabled in CI build, or explicitly opted-out from with the -excludeCIBinarylog switch.' ExitWithExitCode 1 } - if ($nodeReuse) { + # Node reuse must be disabled in CI builds unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if ($nodeReuse -and $env:MSBUILD_NODEREUSE_ENABLED -ne "1") { Write-PipelineTelemetryError -Category 'Build' -Message 'Node reuse must be disabled in CI build.' ExitWithExitCode 1 } } - Enable-Nuget-EnhancedRetry - $buildTool = InitializeBuildTool $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" @@ -836,6 +766,10 @@ function MSBuild-Core() { $cmdArgs += ' /p:TreatWarningsAsErrors=false' } + if ($warnAsError -and $warnNotAsError) { + $cmdArgs += " /warnnotaserror:$warnNotAsError /p:AdditionalWarningsNotAsErrors=$warnNotAsError" + } + foreach ($arg in $args) { if ($null -ne $arg -and $arg.Trim() -ne "") { if ($arg.EndsWith('\')) { @@ -873,6 +807,40 @@ function MSBuild-Core() { } } +# +# Executes a dotnet command with arguments passed to the function. +# Terminates the script if the command fails. +# +function DotNet() { + $dotnetRoot = InitializeDotNetCli -install:$restore + $dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet') + + $cmdArgs = "" + foreach ($arg in $args) { + if ($null -ne $arg -and $arg.Trim() -ne "") { + if ($arg.EndsWith('\')) { + $arg = $arg + "\" + } + $cmdArgs += " `"$arg`"" + } + } + + $env:ARCADE_BUILD_TOOL_COMMAND = "`"$dotnetPath`" $cmdArgs" + + $exitCode = Exec-Process $dotnetPath $cmdArgs + + if ($exitCode -ne 0) { + Write-Host "dotnet command failed with exit code $exitCode. Check errors above." -ForegroundColor Red + + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) { + Write-PipelineSetResult -Result "Failed" -Message "dotnet command execution failed." + ExitWithExitCode 0 + } else { + ExitWithExitCode $exitCode + } + } +} + function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { @@ -930,6 +898,12 @@ Create-Directory $ToolsetDir Create-Directory $TempDir Create-Directory $LogDir +# Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location +# under artifacts/log so they are captured as build artifacts in CI. +if (-not $env:MSBUILDDEBUGPATH) { + $env:MSBUILDDEBUGPATH = Join-Path $LogDir 'MsbuildDebugLogs' +} + Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir @@ -951,19 +925,5 @@ if (!$disableConfigureToolsetImport) { } } -# -# If $ci flag is set, turn on (and log that we did) special environment variables for improved Nuget client retry logic. -# -function Enable-Nuget-EnhancedRetry() { - if ($ci) { - Write-Host "Setting NUGET enhanced retry environment variables" - $env:NUGET_ENABLE_ENHANCED_HTTP_RETRY = 'true' - $env:NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT = 6 - $env:NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS = 1000 - $env:NUGET_RETRY_HTTP_429 = 'true' - Write-PipelineSetVariable -Name 'NUGET_ENABLE_ENHANCED_HTTP_RETRY' -Value 'true' - Write-PipelineSetVariable -Name 'NUGET_ENHANCED_MAX_NETWORK_TRY_COUNT' -Value '6' - Write-PipelineSetVariable -Name 'NUGET_ENHANCED_NETWORK_RETRY_DELAY_MILLISECONDS' -Value '1000' - Write-PipelineSetVariable -Name 'NUGET_RETRY_HTTP_429' -Value 'true' - } -} +# Initialize the nuget package cache vars +$nugetPackageCachePath = InitializeNuGetPackageCachePath diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 1b296f646c2..69ca926a6a8 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -8,16 +8,6 @@ ci=${ci:-false} # Build mode source_build=${source_build:-false} -# Set to true to use the pipelines logger which will enable Azure logging output. -# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md -# This flag is meant as a temporary opt-opt for the feature while validate it across -# our consumers. It will be deleted in the future. -if [[ "$ci" == true ]]; then - pipelines_log=${pipelines_log:-true} -else - pipelines_log=${pipelines_log:-false} -fi - # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} @@ -52,6 +42,9 @@ fi # Configures warning treatment in msbuild. warn_as_error=${warn_as_error:-true} +# Specifies semi-colon delimited list of warning codes that should not be treated as errors. +warn_not_as_error=${warn_not_as_error:-''} + # True to attempt using .NET Core already that meets requirements specified in global.json # installed on the machine instead of downloading one. use_installed_dotnet_cli=${use_installed_dotnet_cli:-true} @@ -115,9 +108,6 @@ function InitializeDotNetCli { local install=$1 - # Don't resolve runtime, shared framework, or SDK from other locations to ensure build determinism - export DOTNET_MULTILEVEL_LOOKUP=0 - # Disable first run since we want to control all package sources export DOTNET_NOLOGO=1 @@ -148,7 +138,11 @@ function InitializeDotNetCli { if [[ $global_json_has_runtimes == false && -n "${DOTNET_INSTALL_DIR:-}" && -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then dotnet_root="$DOTNET_INSTALL_DIR" else - dotnet_root="${repo_root}.dotnet" + if [[ -n "${DOTNET_GLOBAL_INSTALL_DIR:-}" ]]; then + dotnet_root="$DOTNET_GLOBAL_INSTALL_DIR" + else + dotnet_root="${repo_root}.dotnet" + fi export DOTNET_INSTALL_DIR="$dotnet_root" @@ -166,7 +160,6 @@ function InitializeDotNetCli { # build steps from using anything other than what we've downloaded. Write-PipelinePrependPath -path "$dotnet_root" - Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" Write-PipelineSetVariable -name "DOTNET_NOLOGO" -value "1" # return value @@ -188,6 +181,8 @@ function InstallDotNet { local version=$2 local runtime=$4 + # For performance this check is duplicated in src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs + # if you are making changes here, consider if you need to make changes there as well. local dotnetVersionLabel="'$runtime v$version'" if [[ -n "${4:-}" ]] && [ "$4" != 'sdk' ]; then runtimePath="$root" @@ -369,7 +364,7 @@ function InitializeBuildTool { _InitializeBuildToolCommand="msbuild" } -function GetNuGetPackageCachePath { +function InitializeNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then export NUGET_PACKAGES="$HOME/.nuget/packages/" @@ -379,7 +374,7 @@ function GetNuGetPackageCachePath { fi # return value - _GetNuGetPackageCachePath=$NUGET_PACKAGES + _InitializeNuGetPackageCachePath=$NUGET_PACKAGES } function InitializeNativeTools() { @@ -401,20 +396,21 @@ function InitializeToolset { return fi - GetNuGetPackageCachePath - ReadGlobalVersion "Microsoft.DotNet.Arcade.Sdk" local toolset_version=$_ReadGlobalVersion - local toolset_location_file="$toolset_dir/$toolset_version.txt" + local toolset_tools_dir="$toolset_dir/$toolset_version" - if [[ -a "$toolset_location_file" ]]; then - local path=`cat "$toolset_location_file"` - if [[ -a "$path" ]]; then - # return value - _InitializeToolset="$path" - return - fi + # Check if the toolset has already been extracted + local toolset_build_proj="" + if [[ -a "$toolset_tools_dir/Build.proj" ]]; then + toolset_build_proj="$toolset_tools_dir/Build.proj" + fi + + if [[ -n "$toolset_build_proj" ]]; then + # return value + _InitializeToolset="$toolset_build_proj" + return fi if [[ "$restore" != true ]]; then @@ -422,20 +418,37 @@ function InitializeToolset { ExitWithExitCode 2 fi - local proj="$toolset_dir/restore.proj" + local download_args=("package" "download" "Microsoft.DotNet.Arcade.Sdk@$toolset_version" "--verbosity" "minimal" "--prerelease" "--output" "$_InitializeNuGetPackageCachePath") + local nuget_config="${NUGET_CONFIG:-}" + if [[ -z "$nuget_config" ]]; then + # Search for any variation of nuget.config in the RepoRoot + local found_config + found_config=$(find "$repo_root" -maxdepth 1 -type f -iname "nuget.config" -print -quit) + + if [[ -n "$found_config" ]]; then + nuget_config="$found_config" + fi + fi - local bl="" - if [[ "$binary_log" == true ]]; then - bl="/bl:$log_dir/ToolsetRestore.binlog" + if [[ -n "$nuget_config" ]]; then + download_args+=("--configfile" "$nuget_config") fi + DotNet "${download_args[@]}" - echo '' > "$proj" - MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" + local package_dir="$_InitializeNuGetPackageCachePath/microsoft.dotnet.arcade.sdk/$toolset_version" - local toolset_build_proj=`cat "$toolset_location_file"` + if [[ ! -d "$package_dir/toolset" ]]; then + Write-PipelineTelemetryError -category 'InitializeToolset' "Arcade SDK package does not contain a toolset folder: $package_dir" + ExitWithExitCode 3 + fi - if [[ ! -a "$toolset_build_proj" ]]; then - Write-PipelineTelemetryError -category 'Build' "Invalid toolset path: $toolset_build_proj" + mkdir -p "$toolset_tools_dir" + cp -r "$package_dir/toolset/." "$toolset_tools_dir" + + if [[ -a "$toolset_tools_dir/Build.proj" ]]; then + toolset_build_proj="$toolset_tools_dir/Build.proj" + else + Write-PipelineTelemetryError -category 'Build' "Unable to find Build.proj in toolset at: $toolset_tools_dir" ExitWithExitCode 3 fi @@ -453,45 +466,41 @@ function ExitWithExitCode { function StopProcesses { echo "Killing running build processes..." pkill -9 "dotnet" || true - pkill -9 "vbcscompiler" || true + pkill -9 -i -x VBCSCompiler || true + pkill -9 -i -x MSBuild || true return 0 } -function MSBuild { - local args=( "$@" ) - if [[ "$pipelines_log" == true ]]; then - InitializeBuildTool - InitializeToolset - - if [[ "$ci" == true ]]; then - export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 - export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 - Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" - Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - fi +function DotNet { + InitializeDotNetCli $restore - local toolset_dir="${_InitializeToolset%/*}" - local selectedPath="$toolset_dir/net/Microsoft.DotNet.ArcadeLogging.dll" + local dotnet_path="$_InitializeDotNetCli/dotnet" - if [[ -z "$selectedPath" ]]; then - Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly: $selectedPath" - ExitWithExitCode 1 - fi + export ARCADE_BUILD_TOOL_COMMAND="$dotnet_path $@" - args+=( "-logger:$selectedPath" ) - fi + "$dotnet_path" "$@" || { + local exit_code=$? + echo "dotnet command failed with exit code $exit_code. Check errors above." - MSBuild-Core "${args[@]}" + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then + Write-PipelineSetResult -result "Failed" -message "dotnet command execution failed." + ExitWithExitCode 0 + else + ExitWithExitCode $exit_code + fi + } } -function MSBuild-Core { +function MSBuild { if [[ "$ci" == true ]]; then if [[ "$binary_log" != true && "$exclude_ci_binary_log" != true ]]; then Write-PipelineTelemetryError -category 'Build' "Binary log must be enabled in CI build, or explicitly opted-out from with the -noBinaryLog switch." ExitWithExitCode 1 fi - if [[ "$node_reuse" == true ]]; then + # Node reuse must be disabled in CI builds unless explicitly opted in via MSBUILD_NODEREUSE_ENABLED. + # Internal testing only; this env var will be replaced with a switch (https://github.com/dotnet/arcade/issues/17013) and must not be depended on. + if [[ "$node_reuse" == true && "${MSBUILD_NODEREUSE_ENABLED:-}" != "1" ]]; then Write-PipelineTelemetryError -category 'Build' "Node reuse must be disabled in CI build." ExitWithExitCode 1 fi @@ -532,7 +541,12 @@ function MSBuild-Core { mt_switch="-mt" fi - RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" + local warnnotaserror_switch="" + if [[ -n "$warn_not_as_error" && "$warn_as_error" == true ]]; then + warnnotaserror_switch="/warnnotaserror:$warn_not_as_error /p:AdditionalWarningsNotAsErrors=$warn_not_as_error" + fi + + RunBuildTool "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch $mt_switch $warnnotaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" } function GetDarc { @@ -549,8 +563,17 @@ function GetDarc { # Returns a full path to an Arcade SDK task project file. function GetSdkTaskProject { - taskName=$1 - echo "$(dirname $_InitializeToolset)/SdkTasks/$taskName.proj" + local taskName=$1 + local toolsetDir + toolsetDir="$(dirname "$_InitializeToolset")" + local proj="$toolsetDir/$taskName.proj" + if [[ -a "$proj" ]]; then + echo "$proj" + return + fi + + Write-PipelineTelemetryError -category 'Build' "Unable to find $taskName.proj in toolset at: $toolsetDir" + ExitWithExitCode 3 } ResolvePath "${BASH_SOURCE[0]}" @@ -588,6 +611,12 @@ mkdir -p "$toolset_dir" mkdir -p "$temp_dir" mkdir -p "$log_dir" +# Direct MSBuild crash diagnostics (MSB4166 failure.txt files) to a known location +# under artifacts/log so they are captured as build artifacts in CI. +if [[ -z "${MSBUILDDEBUGPATH:-}" ]]; then + export MSBUILDDEBUGPATH="$log_dir/MsbuildDebugLogs" +fi + Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir" Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir" @@ -608,3 +637,6 @@ fi if [[ -n "${useInstalledDotNetCli:-}" ]]; then use_installed_dotnet_cli="$useInstalledDotNetCli" fi + +# Initialize the nuget package cache vars +InitializeNuGetPackageCachePath diff --git a/global.json b/global.json index 7d1a9d739bc..9a6b38ee70c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.301", + "version": "11.0.100-preview.5.26227.104", "allowPrerelease": true, "paths": [ ".dotnet", @@ -12,7 +12,7 @@ "runner": "Microsoft.Testing.Platform" }, "tools": { - "dotnet": "10.0.301", + "dotnet": "11.0.100-preview.5.26227.104", "vs": { "version": "18.0", "components": [ @@ -22,7 +22,7 @@ "xcopy-msbuild": "18.0.0" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.26324.4", + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26325.1", "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2" } } From 205c6580aca354298db1c76c3b6cb1c3b0d39b9d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:52:41 +0200 Subject: [PATCH 10/11] Update dependencies from https://github.com/dotnet/roslyn build 20260707.6 (#20042) On relative base path root Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.Compilers , Microsoft.CodeAnalysis.CSharp , Microsoft.CodeAnalysis.EditorFeatures , Microsoft.CodeAnalysis.EditorFeatures.Text , Microsoft.CodeAnalysis.ExternalAccess.FSharp , Microsoft.CodeAnalysis.Features , Microsoft.VisualStudio.LanguageServices From Version 5.10.0-1.26356.6 -> To Version 5.10.0-1.26357.6 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.props | 16 ++++++++-------- eng/Version.Details.xml | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index bf9ac2ce209..a15d81ee08f 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -19,14 +19,14 @@ This file should be imported by eng/Versions.props 1.0.0-prerelease.26318.1 1.0.0-prerelease.26318.1 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 - 5.10.0-1.26356.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 + 5.10.0-1.26357.6 10.0.2 10.0.2 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3960e571dcb..c075468501a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -18,37 +18,37 @@ https://github.com/dotnet/msbuild e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 - + https://github.com/dotnet/roslyn - ed7c2f0b8555529c2abd079945dbc918f0e009df + 97ee762dcf4f7135ff591ebf24b6f1dab3fe0632 From ea3908edab08f1009d0bde1883778797c785170a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 09:52:45 +0200 Subject: [PATCH 11/11] Update dependencies from https://github.com/dotnet/msbuild build 20260707.8 (#20041) On relative base path root Microsoft.Build , Microsoft.Build.Framework , Microsoft.Build.Tasks.Core , Microsoft.Build.Utilities.Core From Version 18.10.0-preview-26353-05 -> To Version 18.10.0-preview-26357-08 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.props | 8 ++++---- eng/Version.Details.xml | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index a15d81ee08f..96a9b125d5c 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -8,10 +8,10 @@ This file should be imported by eng/Versions.props 10.0.0-beta.26324.4 - 18.10.0-preview-26353-05 - 18.10.0-preview-26353-05 - 18.10.0-preview-26353-05 - 18.10.0-preview-26353-05 + 18.10.0-preview-26357-08 + 18.10.0-preview-26357-08 + 18.10.0-preview-26357-08 + 18.10.0-preview-26357-08 1.0.0-prerelease.26318.1 1.0.0-prerelease.26318.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c075468501a..dbe95ffcb65 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,21 +2,21 @@ - + https://github.com/dotnet/msbuild - e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 + 746aeb090c9e2bcedc398751370da862014ebf7a - + https://github.com/dotnet/msbuild - e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 + 746aeb090c9e2bcedc398751370da862014ebf7a - + https://github.com/dotnet/msbuild - e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 + 746aeb090c9e2bcedc398751370da862014ebf7a - + https://github.com/dotnet/msbuild - e2c0a316c8fb5b2d991eb71bdd78bc4a8e279bf8 + 746aeb090c9e2bcedc398751370da862014ebf7a https://github.com/dotnet/roslyn