Skip to content

[.NET/CoreVideo] Use [UnmanagedCallersOnly] instead of [MonoPInvokeCallback] Partial Fix for #10470 - #15892

Merged
stephen-hawley merged 3 commits into
dotnet:mainfrom
stephen-hawley:pinvoke-corevideo
Sep 8, 2022
Merged

[.NET/CoreVideo] Use [UnmanagedCallersOnly] instead of [MonoPInvokeCallback] Partial Fix for #10470#15892
stephen-hawley merged 3 commits into
dotnet:mainfrom
stephen-hawley:pinvoke-corevideo

Conversation

@stephen-hawley

Copy link
Copy Markdown
Contributor

straightforward

@stephen-hawley stephen-hawley added skip-device-tests Skip device tests not-notes-worthy Ignore for release notes labels Sep 7, 2022
Comment thread src/CoreVideo/CVDisplayLink.cs Outdated
var tempInNow = *inNow;
var tempInOutputTime = *inOutputTime;
var tempFlagsOut = *flagsOut;
var returnValue = func (delegateDisplayLink, ref tempInNow, ref tempInOutputTime, flagsIn, ref tempFlagsOut);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not a big deal, but I think you can use System.Runtime.InteropServices.Unsafe.Unsafe.AsRef<T> here:

https://github.com/xamarin/xamarin-macios/blob/6590c113e47abd969d636b0d9c00769fa371a110/src/Security/SslConnection.cs#L103

so it becomes something like:

Suggested change
var returnValue = func (delegateDisplayLink, ref tempInNow, ref tempInOutputTime, flagsIn, ref tempFlagsOut);
var returnValue = func (delegateDisplayLink, ref System.Runtime.CompilerServices.Unsafe.AsRef<CVTimeStamp> (inNow), ...);

and that way you wouldn't have to create the temporary variables.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I looked this over in SharpLab and it looks like a win.

@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
Copy Markdown
Collaborator

🔥 [PR Build] Build failed 🔥

Build failed for the job 'Detect API changes'

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 Unable to find the contents for the comment: D:\a\1\s\change-detection\results\gh-comment.md does not exist :fire

Pipeline on Agent
Hash: 27c8bbc55bf4a74640991c96b887b2ddc6a3e5ad [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: 27c8bbc55bf4a74640991c96b887b2ddc6a3e5ad [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMBOT-1042.Monterey'
Hash: 27c8bbc55bf4a74640991c96b887b2ddc6a3e5ad [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

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

Failed tests are:

  • monotouch-test

Pipeline on Agent
Hash: 27c8bbc55bf4a74640991c96b887b2ddc6a3e5ad [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 223 tests passed 🎉

Tests counts

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 23 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: [PR build]

@stephen-hawley
stephen-hawley merged commit 182761d into dotnet:main Sep 8, 2022
@stephen-hawley
stephen-hawley deleted the pinvoke-corevideo branch September 8, 2022 14:12
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 skip-device-tests Skip device tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants