Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net10.0] Merge main into net10.0. #22215

Open
wants to merge 57 commits into
base: net10.0
Choose a base branch
from

Conversation

rolfbjarne
Copy link
Member

No description provided.

rolfbjarne and others added 30 commits February 12, 2025 08:27
This pull request updates the following dependencies

## From https://github.com/dotnet/arcade

- **Subscription**: 6ddbc71e-6118-4fea-a928-58d1b2579c38
- **Build**: 20250127.4
- **Date Produced**: January 27, 2025 10:35:09 PM UTC
- **Commit**: bac7e1caea791275b7c3ccb4cb75fd6a04a26618
- **Branch**: refs/heads/release/9.0

- **Updates**:
  - **Microsoft.DotNet.Arcade.Sdk**: [from 9.0.0-beta.25058.5 to 9.0.0-beta.25077.4][2]
  - **Microsoft.DotNet.Build.Tasks.Feed**: [from 9.0.0-beta.25058.5 to 9.0.0-beta.25077.4][2]

[2]: dotnet/arcade@8cc6ecd...bac7e1c

- **Updates to .NET SDKs:**
  - Updates sdk.version to 9.0.102
  - Updates tools.dotnet to 9.0.102
* Clean up code that checks OS versions when the version checked for is earlier
  than the earliest OS version we support - in which case the check is
  redundant, and we can remove a lot of dead code.
* Remove !NET code.
* Enable nullability everywhere.
* Add missing availability attributes.
* Fix a few misc issues found by our tests.
* Use BindAs in a few places to avoid manual code.
…22139)

Add a new property to the data models that will allow us to make the
decision if a temp variable is needed when generating the code for a
method or property.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Add code that will parse a binding and will create the data model. This
PR only focuses on parsing interfaces and ensuring that the correct
binding type is used and that the attributes are correctly parsed.

We are ignoring methods, constructors, properties and events which will
be added in other PRS to keep diffs easier to review.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
…ation. (#22156)

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
…ia Cecil (#22149)

The trimmer has logic which relies on IL Offsets for each instruction to differentiate events from different instructions. If there are two instructions with the same offset it can lead to confusion and eventually failures.

There's more detailed discussion of the problem in dotnet/runtime#110753

This change modifies all the places where the custom steps are generating IL instructions to also generate unique IL offsets for each instruction (the actual values don't matter really).

This should fix the problem in dotnet/runtime#110714

This is an unforked version of #22127 (required due to CI restrictions).

---------

Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
This is clearly an enum of flags; we even use flags when declaring thde 'All'
enum value.

Fixes #22125.
* Remove all !NET code from these files.
* Autoformat.

These changes focus on conditional NET code that causes formatting to differ
depending on whether NET is defined or not (thus removing any !NET code
unifies code formatting across conditional compilation symbols).

This PR might be easier to view with whitespace changes disabled.
…2141)

This matches the casing of `SetObjectForKey` method for other types.

Fixes #22103.
Update the transformer code to parse the properties from a binding. This
adds a all properties that the binding has that are either a property or
a field.
There is no need to have a special case in that method. We can use the
new added 'Using' method. Update the tests to show that the results are
identical but with a more homogeneus API.
Sets the default for switch added in dotnet/sdk#46375.

(Should merge before we start consuming the SDK/runtime that has this.)

Supersedes PR #22074 so that we can run the CI

/cc @MichalStrehovsky @ivanpovazan 

---------

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Remove redundant OS version checks (if the OS checked for is earlier than
  the earliest we support).
* Bring CVBuffer.GetAttachment<T> to macOS to unify API across all platforms.
* Rearrange code so that the indentation is the same on all conditional code
  paths (that way code formatters don't fight depending on which conditional
  compilation symbols are defined).
Based on the return value of the getter, decide if we need to use a
return temp variable or not. Pay attention to the tests, because the
generated code for macOS and tvOS differs from the one for iOS and
Maccatalyst, the reason is that the GCSize struct in macOS does not need
a temp return value, while it does in iOS.
Looks like windows is slower than unix in this case.
This runs 'dotnet format' on the generated project files, which will format
code inside #if blocks (which 'dotnet format --folder ...' doesn't).

This is a code formatting update only, no functional changes.
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0 to 9.0.1 (parent: Microsoft.NET.Sdk)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0 to 9.0.1 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0 to 9.0.1 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-rtm.24528.2 to 9.0.1-servicing.24604.3 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0 to 9.0.1 (parent: Microsoft.NET.Sdk)
  - **Microsoft.DotNet.Cecil**: from 0.11.5-alpha.24515.1 to 0.11.5-alpha.24602.1 (parent: Microsoft.NETCore.App.Ref)

## From https://github.com/dotnet/sdk

- **Subscription**: afa459aa-bd64-46cb-8138-9f6f795963d4
- **Build**: 20250115.25
- **Date Produced**: January 15, 2025 11:23:38 PM UTC
- **Commit**: 049799c39d766c58ef6388865d5f5ed273b6a75e
- **Branch**: refs/heads/release/9.0.1xx

- **Updates**:
  - **Microsoft.NET.Sdk**: [from 9.0.102-servicing.24610.2 to 9.0.103-servicing.25065.25][1]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0 to 9.0.1][2]
  - **Microsoft.AspNetCore.App.Ref**: [from 9.0.0 to 9.0.1][3]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0 to 9.0.1][2]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-rtm.24528.2 to 9.0.1-servicing.24604.3][4]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0 to 9.0.1][2]
  - **Microsoft.DotNet.Cecil**: [from 0.11.5-alpha.24515.1 to 0.11.5-alpha.24602.1][5]

[1]: dotnet/sdk@a345a00...049799c
[2]: https://dev.azure.com/dnceng/internal/_git/dotnet-runtime/branches?baseVersion=GC9d5a6a9aa463d6d10b0b0ba6d5982cc82f363dc3&targetVersion=GCc8acea22626efab11c13778c028975acdc34678f&_a=files
[3]: https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore/branches?baseVersion=GCaf22effae4069a5dfb9b0735859de48820104f5b&targetVersion=GC4442a188f9200a57635373dcd640893c0e8dcc78&_a=files
[4]: dotnet/emsdk@763d10a...4c9d1b1
[5]: dotnet/cecil@e51bd36...72791f7
Ensure that rgen adds the static readonly fields needed for the
selectors in a class. We do so by:

1. Keeping track if the selectors in the binding context.
2. Provide the same logic as used by bgen for the field names.
3. Add two new factory methods that will write the local declaration
syntaxt for the fields.

We have added tests for:
1. The selector name calculation.
2. The factory methods.
3. Update the expected generated code for a class with propeties.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #b4881fe] Windows Integration Tests failed ❌

❌ Failed ❌

Pipeline on Agent
Hash: b4881fe9839a2da840fbeefd65b5ae523db225c5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

pjcollins and others added 10 commits February 19, 2025 17:02
New Pipeline: https://dev.azure.com/devdiv/DevDiv/_build?definitionId=25491&_a=summary

A new scheduled pipeline has been added to run CodeQL against scoped
build steps.
The use of a temp variable in boolean properties was due to a limitation
of how bgen wrote the code. We copied the behaviour to make sure we were
compatible, yet that was not needed.

This change adds supports to boolean getters in properties without the
need of a temp var.
This makes it easy to reformat code using StyleCop!

I'll start enabling rules in separate PRs.
Add support to return a NSObject or an array of NSObjects. The changes
allow to get the variable assigment from the factory to be used in the
writer.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
When a property that returns an NSNumber array is marked with the BindAs
attribute, the bgen code generator uses the following pattern:

```csharp
NativeHandle retvalarrtmp;
ret = ((retvalarrtmp = global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend (this.Handle, Selector.GetHandle ("sourceSampleDataTrackIDs"))) == IntPtr.Zero ? null! : (NSArray.ArrayFromHandleFunc <int> (retvalarrtmp, ptr => {
  using (var num = Runtime.GetNSObject<NSNumber> (ptr)!) {
    return (int) num.Int32Value;
  }
}, false)));
```
This code can be simplified to use a static group method. So that it
looks like:
```csharp
NativeHandle retvalarrtmp;
ret = ((retvalarrtmp = global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend (this.Handle, Selector.GetHandle ("sourceSampleDataTrackIDs"))) == IntPtr.Zero ? null! : (NSArray.ArrayFromHandleFunc <int> (retvalarrtmp, NSNumber.ToInt32, false)));
```
A seasoned C# developer would mention that in C# 10 and under using
method groups (specially static ones) alocates more memory than using
lambdas (lambdas were cached, static methods were not, see
dotnet/roslyn#5835). Alas, this is not longer
the case after dotnet/roslyn#58288 which means
that the memory usage is the same allowing us to clean our generated
code.

Using static group methods also opens the door to other possible
improvements mentioned in the roslyn PR.

PS: This is some extra work we are doing to make the generated code
simpler before we move to rgen.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Xcode provisioning failed on the last nightly CodeQL build attempt with:

    Xcode Select 16.2.0: provisioning claims to have completed successfully, but its condition still fails.

I am not sure if this is related to CodeQL setup, but we can wait to run
that setup until after environment provisioning is complete.
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #998dcb9] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #998dcb9] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #998dcb9] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build #998dcb9] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build #998dcb9] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build #998dcb9] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 Failed to compare API and create generator diff 🔥

Error: 'make' failed for the hash 12d38e2.

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build #998dcb9] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #998dcb9] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 112 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 998dcb953a662200dac416817799f0de4b19d79f [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants