Skip to content

Conversation

@tj-devel709
Copy link
Member

This PR aims to bring nullability changes to OpenGL.
Following the steps here:

  1. I am adding nullable enable to all manual files that are not "API_SOURCES" in src/frameworks.sources and making the required nullability changes
  2. Changing all throw new ArgumentNullException ("object")); to ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (object)); for size saving optimization as well to mark that this framework contains nullability changes
  3. Changing any == null or != null to is null and is not null

@tj-devel709 tj-devel709 added the not-notes-worthy Ignore for release notes label Jun 1, 2022
@tj-devel709 tj-devel709 added this to the Future milestone Jun 1, 2022
Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is only whitespace changes, so not really needed?

https://github.com/xamarin/xamarin-macios/pull/15174/files/93c7310e51ddbeb45192d5d9702efc581bffc987..4ee26674163227a1e9794b4a15d15f6e310dcb14?w=1

NVM, just saw a portion of the PR

@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.

@tj-devel709
Copy link
Member Author

@rolfbjarne Changes addressed!

@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.

Copy link
Contributor

@chamons chamons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general LGTM but I'm concerned that some of these changes are non-trivial, and we have literally no coverage/expected usage of some of this code.

Who is using MonoMacGameView.cs these days?

On one hand, that makes it lower risk (as few people will be impacted), but on the other hand we have likely zero sample coverage and it could stay broken awhile.

I think this is fine, but just something for us to consider.

@tj-devel709
Copy link
Member Author

Unrelated Test Failures: https://github.com/xamarin/maccore/issues/2558

Copy link
Member

@mandel-macaque mandel-macaque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chamons I have the same though, the AssertContext was removed, which changes a behaviour in which we are throwing an exception, yet if you look closely what @tj-devel709 did was the following:

  1. Remove the method.
  2. Add the logic of the method to the property.

The change makes sense, since we are using now the property to access the OpenGL context, yet it has an undesired runtime effect. Our users used to be able to get a null variable out of the properties, now they are getting an exception. My fear here is that a user would be doing something like this:

if (view. OpenGLContext == null) {
    // call the init code
}

The above code, with the changes, will not work because it is throwing an exception. Now, issue here is that the Assert method is not very helpful with regards of nullability and hence the change from @tj-devel709 I propose something in between:

  1. Revert the property change to not throw and return null
  2. Add a private property that does the new logic, and call it _OpenGLContext

With the above, you have what @tj-devel709 was looking for and what @chamons wants (no runtime changes).

@chamons
Copy link
Contributor

chamons commented Jun 6, 2022

Or you could could it GetOpenGLContext() or ActualOpenGLContext. I'm not a huge fan of underscores having different behavior.

@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.

Comment on lines +142 to +145
get {
if (pixelFormat is null)
throw new InvalidOperationException ("Operation requires a PixelFormat that cannot be null.");
return pixelFormat;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property has AFAIK the same issue as the OpenGL one we talked about. You are throwing an exception on a property that did not used to and returned a null variable correctly. We are changing the behaviour and we should not.

get => openGLContext;
}

public NSOpenGLContext ActualOpenGLContext {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be public, you are adding a public property that is not needed since we have the OpenGLContext. This is an implementation detail that we are leaking to the users.

Suggested change
public NSOpenGLContext ActualOpenGLContext {
private NSOpenGLContext ActualOpenGLContext {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: 45f301ad0e78d68a592a731002333acc2b628a25 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1030.Monterey'
Hash: 45f301ad0e78d68a592a731002333acc2b628a25 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 45f301ad0e78d68a592a731002333acc2b628a25 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Failed tests are:

  • xammac_tests
  • monotouch-test

Pipeline on Agent
Hash: 45f301ad0e78d68a592a731002333acc2b628a25 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build] Tests failed on VSTS: simulator tests iOS ❌

Tests failed on VSTS: simulator tests iOS.

Test results

1 tests failed, 147 tests passed.

Failed tests

  • introspection/watchOS 32-bits - simulator/Debug: Crashed

Pipeline on Agent XAMBOT-1030.Monterey'
Merge 45f301a into 011f977

@tj-devel709
Copy link
Member Author

Unrelated Test Failure: https://github.com/xamarin/maccore/issues/2558

@tj-devel709 tj-devel709 merged commit a1e53d6 into dotnet:main Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-notes-worthy Ignore for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants