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

[coremedia] Add nullability to (generated and manual) bindings #15066

Merged
merged 4 commits into from
Jun 6, 2022

Conversation

tj-devel709
Copy link
Contributor

This PR aims to bring nullability changes to CoreMedia.
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

@tj-devel709 tj-devel709 added the not-notes-worthy Ignore for release notes label May 19, 2022
@tj-devel709 tj-devel709 added this to the Future milestone May 19, 2022
return ((CMCustomBlockAllocator) gch.Target).Allocate (sizeInBytes);
if (gch.Target is CMCustomBlockAllocator target)
return target.Allocate (sizeInBytes);
return IntPtr.Zero;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is correct

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me, can't be much worse than throwing a InvalidCastException.

if (retMappingInvalid != IntPtr.Zero)
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange));
if (retMappingInvalid != IntPtr.Zero)
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange))!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also not sure if these castings should be !. I tried making these CMTimeRange nullable, but I remember Rolf said not to make structs nullable

Copy link
Member

Choose a reason for hiding this comment

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

For both of your questions, I would use the ! since we might be changing behaviour in both cases.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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.

This code does not compile:

Foundation/DictionaryContainer.cs(320,39): error CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

make[1]: *** [build/dotnet/maccatalyst/64/Microsoft.MacCatalyst.dll] Error 1

make[1]: *** Waiting for unfinished jobs....

Foundation/DictionaryContainer.cs(320,39): error CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

make[1]: *** [build/mac/mobile-64/Xamarin.Mac.dll] Error 1

Foundation/DictionaryContainer.cs(320,39): warning CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

Foundation/DictionaryContainer.cs(320,39): warning CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

Foundation/DictionaryContainer.cs(320,39): warning CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

Foundation/DictionaryContainer.cs(320,39): error CS8604: Possible null reference argument for parameter 'dict' in 'CMTime CMTime.FromDictionary(NSDictionary dict)'.

if (retMappingInvalid != IntPtr.Zero)
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange));
if (retMappingInvalid != IntPtr.Zero)
InvalidMapping = (CMTimeRange)Marshal.PtrToStructure (retMappingInvalid, typeof(CMTimeRange))!;
Copy link
Member

Choose a reason for hiding this comment

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

For both of your questions, I would use the ! since we might be changing behaviour in both cases.

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

return ((CMCustomBlockAllocator) gch.Target).Allocate (sizeInBytes);
if (gch.Target is CMCustomBlockAllocator target)
return target.Allocate (sizeInBytes);
return IntPtr.Zero;
Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me, can't be much worse than throwing a InvalidCastException.

@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

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

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: 8a3f49081f88c3b62c2ce2dc12cae4a560998a45

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1094.Monterey'
Hash: 8a3f49081f88c3b62c2ce2dc12cae4a560998a45

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📋 [PR Build] API Diff 📋

API diff (for current PR)

ℹ️ API Diff (from PR only) (please review changes)

API diff: vsdrops gist

Xamarin
.NET
Xamarin vs .NET
iOS vs Mac Catalyst (.NET)

API diff (vs stable)

✅ API Diff from stable

API diff: vsdrops gist

Xamarin
.NET
Xamarin vs .NET
iOS vs Mac Catalyst (.NET)

Generator diff

Generator Diff (no change)

Pipeline on Agent XAMBOT-1100.Monterey'
Hash: 8a3f49081f88c3b62c2ce2dc12cae4a560998a45

@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-1103.Monterey
Merge 8a3f490 into 0307004

@tj-devel709
Copy link
Contributor Author

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

@tj-devel709 tj-devel709 merged commit 97867a5 into xamarin:main Jun 6, 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.

4 participants