dotnet / dotnet/macios

FSEvent.GetUuidForDevice is incorrect

Open
#13,011 1 comment 0 reactions 0 assignees View on GitHub
bug copilot-candidate good first issue macOS
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

The FSEvent.GetUuidForDevice has a few problems:

https://github.com/xamarin/xamarin-macios/blob/313bc16bc76b41b29b520c1d43af03c0ea9db8d5/src/CoreServices/FSEvents.cs#L94-L106

1. `FSEventsCopyUUIDForDevice` returns a retained object reference. This value isn't released (so it's leaked).
2. `FSEventsCopyUUIDForDevice ` returns an object reference. The code treats it like a blob of memory that contains the UUID. The fix is probably to call [`CFUUIDGetUUIDByte `](https://developer.apple.com/documentation/corefoundation/1542119-cfuuidgetuuidbytes?language=objc) on the returned pointer.
3. No tests

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading src/CoreServices/FSEvents.cs at lines 94-106 and the linked Apple API documentation for FSEventsCopyUUIDForDevice and CFUUIDGetUUIDByte. Add tests for the FSEvent.GetUuidForDevice behavior; done means the returned UUID is read correctly, the retained object is released, and the tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.