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

fix: Cocoa Bindings #3278

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fix missing exception StackTraces in some situations ([#3215](https://github.com/getsentry/sentry-dotnet/pull/3215))
- Scopes now get applied to OTEL spans in ASP.NET Core ([#3221](https://github.com/getsentry/sentry-dotnet/pull/3221))
- Fixed InvalidCastException when setting the SampleRate on Android ([#3258](https://github.com/getsentry/sentry-dotnet/pull/3258))
- Fixed MAUI iOS build issue related to `SentryVersionNumber` and `SentryVersionString` ([#3278](https://github.com/getsentry/sentry-dotnet/pull/3278))

### API changes

Expand Down
10 changes: 9 additions & 1 deletion scripts/generate-cocoa-bindings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,25 @@ $Text = $Text -replace '(?ms)@protocol (SentrySerializable|SentrySpan).+?\[Proto
$Text = $Text -replace 'interface SentrySpan\b', "[BaseType (typeof(NSObject))]`n`$&"

# Fix string constants
$Text = $Text -replace 'byte\[\] SentryVersionString', "[PlainString]`n NSString SentryVersionString"
$Text = $Text -replace '(?m)(.*\n){2}^\s{4}NSString k.+?\n\n?', ''
$Text = $Text -replace '(?m)(.*\n){4}^partial interface Constants\n{\n}\n', ''
$Text = $Text -replace '\[Verify \(ConstantsInterfaceAssociation\)\]\n', ''

# Remove SentryVersionNumber
$Text = $Text -replace '.*SentryVersionNumber.*\n?', ''

# Remove SentryVersionString
$Text = $Text -replace '.*SentryVersionString.*\n?', ''

# Remove duplicate attributes
$s = 'partial interface Constants'
$t = $Text -split $s, 2
$t[1] = $t[1] -replace "\[Static\]\n\[Internal\]\n$s", $s
$Text = $t -join $s

# Remove empty Constants block
$Text = $Text -replace '\[Static\]\s*\[Internal\]\s*partial\s+interface\s+Constants\s\{[\s\n]*\}\n\n', ''

# Update MethodToProperty translations
$Text = $Text -replace '(Export \("get\w+"\)\]\n)\s*\[Verify \(MethodToProperty\)\]\n(.+ \{ get; \})', '$1$2'
$Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+ (?:Hash|Value|DefaultIntegrations) \{ get; \})', '$1'
Expand Down
14 changes: 0 additions & 14 deletions src/Sentry.Bindings.Cocoa/ApiDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@

namespace Sentry.CocoaSdk;

[Static]
[Internal]
partial interface Constants
{
// extern double SentryVersionNumber;
[Field ("SentryVersionNumber", "__Internal")]
double SentryVersionNumber { get; }

// extern const unsigned char[] SentryVersionString;
[Field ("SentryVersionString", "__Internal")]
[PlainString]
NSString SentryVersionString { get; }
}

// typedef void (^SentryRequestFinished)(NSError * _Nullable);
[Internal]
delegate void SentryRequestFinished ([NullAllowed] NSError error);
Expand Down
Loading