From 6696c12faedea00a849d16258e1aebe70572812e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 2 Sep 2025 17:39:59 +0200 Subject: [PATCH 01/36] WIP: Generate bindings from Sentry-Swift.h --- .gitignore | 2 +- scripts/generate-cocoa-bindings.ps1 | 59 +- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 715 ++++++++++++-- .../Sentry.Bindings.Cocoa.csproj | 2 - src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 81 ++ .../SwiftApiDefinitions.cs | 893 ------------------ .../SwiftStructsAndEnums.cs | 90 -- .../Program.cs | 132 +++ ...Sentry.Bindings.Cocoa.PostProcessor.csproj | 14 + 9 files changed, 914 insertions(+), 1074 deletions(-) delete mode 100644 src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs delete mode 100644 src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs create mode 100644 tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs create mode 100644 tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj diff --git a/.gitignore b/.gitignore index 23c230d87a..ce13a6a8b0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ docs/docfx.zip mono_crash.*.json test_output/ test/**/*.apk -/tools/ +/tools/sentry-cli/ *.log .sentry-native **/EnvironmentVariables.g.cs diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index f91b32f4c7..2faea90a52 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -103,7 +103,8 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ } # Get iPhone SDK version -$iPhoneSdkVersion = sharpie xcode -sdks | grep -o -m 1 'iphoneos\S*' +$XcodePath = (xcode-select -p) -replace '/Contents/Developer$', '' +$iPhoneSdkVersion = sharpie xcode -xcode $XcodePath -sdks | grep -o -m 1 'iphoneos\S*' Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" ## Imports in the various header files are provided in the "new" style of: @@ -141,12 +142,30 @@ else { Write-Host "File not found: $privateHeaderFile" } +$swiftHeaderFile = "$HeadersPath/Sentry-Swift.h" +if (Test-Path $swiftHeaderFile) +{ + $content = Get-Content -Path $swiftHeaderFile -Raw + # Replace module @imports with traditional #includes + $content = $content -replace '(?m)^#if\s+(__has_feature\(objc_modules\))', '#if 1 // $1' + $content = $content -replace '(?m)^@import\s+ObjectiveC;\s*\n', '' + $content = $content -replace '(?m)^@import\s+(\w+);', '#include <$1/$1.h>' + $content = $content -replace '(?m)^#import\s+"Sentry.h"\s*\n', '' + + Set-Content -Path $swiftHeaderFile -Value $content + Write-Host "Patched includes: $swiftHeaderFile" +} +else +{ + Write-Host "File not found: $swiftHeaderFile" +} # Generate bindings Write-Output 'Generating bindings with Objective Sharpie.' sharpie bind -sdk $iPhoneSdkVersion ` -scope "$CocoaSdkPath" ` "$HeadersPath/Sentry.h" ` + "$HeadersPath/Sentry-Swift.h" ` "$PrivateHeadersPath/PrivateSentrySDKOnly.h" ` -o $BindingsPath ` -c -Wno-objc-property-no-attribute @@ -214,8 +233,9 @@ $Text = $Text -replace 'using .+;\n\n', "$&namespace Sentry.CocoaSdk;`n`n" # Set Internal attributes on interfaces and delegates $Text = $Text -replace '(?m)^(partial interface|interface|delegate)\b', "[Internal]`n$&" -# Fix ISentrySerializable usage +# Fix interface usage $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' +$Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' # Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 $Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' @@ -235,16 +255,21 @@ $Text = $Text -replace '(SentryBreadcrumb) arg\d', '$1 breadcrumb' $Text = $Text -replace '(SentrySpan) arg\d', '$1 span' $Text = $Text -replace '(SentryAppStartMeasurement) arg\d', '$1 appStartMeasurement' $Text = $Text -replace '(SentryLog) arg\d', '$1 log' +$Text = $Text -replace '(SentryProfileOptions) arg\d', '$1 options' # Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) $Text = $Text -replace 'delegate \w+ Sentry(BeforeBreadcrumb|BeforeSendEvent|TracesSampler)Callback', "[return: NullAllowed]`n$&" +# Rename SentryRRWebEvent protocol +$Text = $Text -replace 'interface (SentryRRWebEvent) : SentrySerializable', 'interface I$1 : SentrySerializable' + # Adjust protocols (some are models) $Text = $Text -replace '(?ms)(@protocol.+?)/\*.+?\*/', '$1' $Text = $Text -replace '(?ms)@protocol (SentrySerializable|SentrySpan).+?\[Protocol\]', "`$&`n[Model]" +$Text = $Text -replace '(?ms)@protocol (SentryRedactOptions).+?\[Protocol \(Name = \"\w+\"\)\]', "`$&`n[Model]" -# Adjust SentrySpan base type -$Text = $Text -replace 'interface SentrySpan\b', "[BaseType (typeof(NSObject))]`n`$&" +# Adjust base types +$Text = $Text -replace 'interface (SentrySpan|SentryRedactOptions)\b', "[BaseType (typeof(NSObject))]`n`$&" # Fix string constants $Text = $Text -replace '(?m)(.*\n){2}^\s{4}NSString k.+?\n\n?', '' @@ -279,9 +304,6 @@ $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' -# Remove default IsEqual implementation (already implemented by NSObject) -$Text = $Text -replace '(?ms)\n?^ *// [^\n]*isEqual:.*?$.*?;\n', '' - # Replace obsolete platform availability attributes $Text = $Text -replace '([\[,] )MacCatalyst \(', '$1Introduced (PlatformName.MacCatalyst, ' $Text = $Text -replace '([\[,] )Mac \(', '$1Introduced (PlatformName.MacOSX, ' @@ -290,24 +312,15 @@ $Text = $Text -replace '([\[,] )iOS \(', '$1Introduced (PlatformName.iOS, ' # Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs $Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' -$Text = $Text -replace '.*SentryEnvelope .*?[\s\S]*?\n\n', '' $Text = $Text -replace '.*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n', '' - -$propertiesToRemove = @( - 'SentryAppStartMeasurement', - 'SentryOnAppStartMeasurementAvailable', - 'SentryMetricsAPI', - 'SentryExperimentalOptions', - 'description', - 'enableMetricKitRawPayload' -) - -foreach ($property in $propertiesToRemove) -{ - $Text = $Text -replace "\n.*property.*$property.*?[\s\S]*?\}\n", '' -} - +$Text = $Text -replace 'NSDictionary', 'NSDictionary' # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" + +################################################################################ +# Post-process ApiDefinitions.cs +################################################################################ +Write-Output "Post-processing $BindingsPath/$File" +& dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 2c076ddf1a..4ef7a50273 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -5,7 +5,9 @@ // ----------------------------------------------------------------------------- using System; +using CoreFoundation; using Foundation; +using MetricKit; using ObjCRuntime; using Sentry; using UIKit; @@ -63,10 +65,6 @@ namespace Sentry.CocoaSdk; [Internal] delegate void SentrySpanCallback (SentrySpan span); -// typedef void (^SentryUserFeedbackConfigurationBlock)(SentryUserFeedbackConfiguration * _Nonnull); -[Internal] -delegate void SentryUserFeedbackConfigurationBlock (SentryUserFeedbackConfiguration arg0); - // @interface SentryAttachment : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -286,10 +284,6 @@ interface SentryClient [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))) __attribute__((deprecated("Use -[SentryClient captureFeedback:withScope:]."))); - [Export ("captureUserFeedback:")] - void CaptureUserFeedback (SentryUserFeedback userFeedback); - // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(feedback:scope:)"))); [Export ("captureFeedback:withScope:")] void CaptureFeedback (SentryFeedback feedback, SentryScope scope); @@ -397,54 +391,6 @@ interface SentryDsn NSUrl EnvelopeEndpoint { get; } } -// @interface SentryEnvelopeItemHeader : NSObject -[BaseType (typeof(NSObject))] -[DisableDefaultCtor] -[Internal] -interface SentryEnvelopeItemHeader : SentrySerializable -{ - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length __attribute__((objc_designated_initializer)); - [Export ("initWithType:length:")] - [DesignatedInitializer] - NativeHandle Constructor (string type, nuint length); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length contentType:(NSString * _Nonnull)contentType; - [Export ("initWithType:length:contentType:")] - NativeHandle Constructor (string type, nuint length, string contentType); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length filenname:(NSString * _Nonnull)filename contentType:(NSString * _Nonnull)contentType; - [Export ("initWithType:length:filenname:contentType:")] - NativeHandle Constructor (string type, nuint length, string filename, string contentType); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length contentType:(NSString * _Nullable)contentType itemCount:(NSNumber * _Nonnull)itemCount; - [Export ("initWithType:length:contentType:itemCount:")] - NativeHandle Constructor (string type, nuint length, [NullAllowed] string contentType, NSNumber itemCount); - - // @property (readonly, copy, nonatomic) NSString * _Nonnull type; - [Export ("type")] - string Type { get; } - - // @property (readonly, nonatomic) NSUInteger length; - [Export ("length")] - nuint Length { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable filename; - [NullAllowed, Export ("filename")] - string Filename { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable contentType; - [NullAllowed, Export ("contentType")] - string ContentType { get; } - - // @property (readonly, copy, nonatomic) NSNumber * _Nullable itemCount; - [NullAllowed, Export ("itemCount", ArgumentSemantic.Copy)] - NSNumber ItemCount { get; } - - // @property (copy, nonatomic) NSString * _Nullable platform; - [NullAllowed, Export ("platform")] - string Platform { get; set; } -} - partial interface Constants { // extern NSString *const _Nonnull SentryErrorDomain __attribute__((visibility("default"))); @@ -1015,10 +961,6 @@ interface SentryHub [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))) __attribute__((deprecated("Use -[SentryHub captureFeedback:]."))); - [Export ("captureUserFeedback:")] - void CaptureUserFeedback (SentryUserFeedback userFeedback); - // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; [Export ("captureFeedback:")] void CaptureFeedback (SentryFeedback feedback); @@ -1681,15 +1623,11 @@ interface SentryOptions // @property (readonly, nonatomic) NSObject * _Nonnull _swiftExperimentalOptions; [Export ("_swiftExperimentalOptions")] NSObject _swiftExperimentalOptions { get; } - - // @property (copy, nonatomic) API_AVAILABLE(ios(13.0)) SentryUserFeedbackConfigurationBlock configureUserFeedback __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); - [Export ("configureUserFeedback", ArgumentSemantic.Copy)] - SentryUserFeedbackConfigurationBlock ConfigureUserFeedback { get; set; } } // typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions * _Nonnull); [Internal] -delegate void SentryProfilingConfigurationBlock (SentryProfileOptions arg0); +delegate void SentryProfilingConfigurationBlock (SentryProfileOptions options); // @interface SentryReplayApi : NSObject [BaseType (typeof(NSObject))] @@ -2199,6 +2137,652 @@ interface SentryUser : SentrySerializable nuint Hash { get; } } +// @interface SentryFeedback : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] +[DisableDefaultCtor] +[Internal] +interface SentryFeedback +{ + // @property (readonly, nonatomic, strong) SentryId * _Nonnull eventId; + [Export ("eventId", ArgumentSemantic.Strong)] + SentryId EventId { get; } + + // -(instancetype _Nonnull)initWithMessage:(NSString * _Nonnull)message name:(NSString * _Nullable)name email:(NSString * _Nullable)email source:(enum SentryFeedbackSource)source associatedEventId:(SentryId * _Nullable)associatedEventId attachments:(NSArray * _Nullable)attachments __attribute__((objc_designated_initializer)); + [Export ("initWithMessage:name:email:source:associatedEventId:attachments:")] + [DesignatedInitializer] + NativeHandle Constructor (string message, [NullAllowed] string name, [NullAllowed] string email, SentryFeedbackSource source, [NullAllowed] SentryId associatedEventId, [NullAllowed] NSData[] attachments); +} + +// @interface SentryId : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] +[Internal] +interface SentryId +{ + // @property (readonly, nonatomic, strong, class) SentryId * _Nonnull empty; + [Static] + [Export ("empty", ArgumentSemantic.Strong)] + SentryId Empty { get; } + + // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; + [Export ("sentryIdString")] + string SentryIdString { get; } + + // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); + [Export ("initWithUuid:")] + [DesignatedInitializer] + NativeHandle Constructor (NSUuid uuid); + + // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); + [Export ("initWithUUIDString:")] + [DesignatedInitializer] + NativeHandle Constructor (string uuidString); + + // @property (readonly, nonatomic) NSUInteger hash; + [Export ("hash")] + nuint Hash { get; } +} + +// @interface SentryLog : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] +[DisableDefaultCtor] +[Internal] +interface SentryLog +{ + // @property (copy, nonatomic) NSDate * _Nonnull timestamp; + [Export ("timestamp", ArgumentSemantic.Copy)] + NSDate Timestamp { get; set; } + + // @property (nonatomic, strong) SentryId * _Nonnull traceId; + [Export ("traceId", ArgumentSemantic.Strong)] + SentryId TraceId { get; set; } + + // @property (nonatomic) enum SentryStructuredLogLevel level; + [Export ("level", ArgumentSemantic.Assign)] + SentryStructuredLogLevel Level { get; set; } + + // @property (copy, nonatomic) NSString * _Nonnull body; + [Export ("body")] + string Body { get; set; } + + // @property (copy, nonatomic) NSDictionary * _Nonnull attributes; + [Export ("attributes", ArgumentSemantic.Copy)] + NSDictionary Attributes { get; set; } + + // @property (nonatomic, strong) NSNumber * _Nullable severityNumber; + [NullAllowed, Export ("severityNumber", ArgumentSemantic.Strong)] + NSNumber SeverityNumber { get; set; } +} + +// @interface SentryLogger : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry12SentryLogger")] +[DisableDefaultCtor] +[Internal] +interface SentryLogger +{ + // -(void)trace:(NSString * _Nonnull)body; + [Export ("trace:")] + void Trace (string body); + + // -(void)trace:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("trace:attributes:")] + void Trace (string body, NSDictionary attributes); + + // -(void)debug:(NSString * _Nonnull)body; + [Export ("debug:")] + void Debug (string body); + + // -(void)debug:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("debug:attributes:")] + void Debug (string body, NSDictionary attributes); + + // -(void)info:(NSString * _Nonnull)body; + [Export ("info:")] + void Info (string body); + + // -(void)info:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("info:attributes:")] + void Info (string body, NSDictionary attributes); + + // -(void)warn:(NSString * _Nonnull)body; + [Export ("warn:")] + void Warn (string body); + + // -(void)warn:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("warn:attributes:")] + void Warn (string body, NSDictionary attributes); + + // -(void)error:(NSString * _Nonnull)body; + [Export ("error:")] + void Error (string body); + + // -(void)error:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("error:attributes:")] + void Error (string body, NSDictionary attributes); + + // -(void)fatal:(NSString * _Nonnull)body; + [Export ("fatal:")] + void Fatal (string body); + + // -(void)fatal:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("fatal:attributes:")] + void Fatal (string body, NSDictionary attributes); +} + +// @interface SentryProfileOptions : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry20SentryProfileOptions")] +[Internal] +interface SentryProfileOptions +{ + // @property (nonatomic) enum SentryProfileLifecycle lifecycle; + [Export ("lifecycle", ArgumentSemantic.Assign)] + SentryProfileLifecycle Lifecycle { get; set; } + + // @property (nonatomic) float sessionSampleRate; + [Export ("sessionSampleRate")] + float SessionSampleRate { get; set; } + + // @property (nonatomic) BOOL profileAppStarts; + [Export ("profileAppStarts")] + bool ProfileAppStarts { get; set; } +} + +// @protocol SentryRRWebEvent +[Protocol] +[Internal] +interface ISentryRRWebEvent : SentrySerializable +{ +} + +// @interface SentryRRWebEvent : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] +[DisableDefaultCtor] +[Internal] +interface SentryRRWebEvent : ISentryRRWebEvent +{ + // @property (readonly, copy, nonatomic) NSDictionary * _Nullable data; + [NullAllowed, Export ("data", ArgumentSemantic.Copy)] + NSDictionary Data { get; } + + // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); + [Export ("serialize")] + NSDictionary Serialize(); +} + +// @protocol SentryRedactOptions +[Protocol (Name = "_TtP6Sentry19SentryRedactOptions_")] +[Model] +[Internal] +[BaseType (typeof(NSObject))] +interface SentryRedactOptions +{ + // @required @property (readonly, nonatomic) BOOL maskAllText; + [Abstract] + [Export ("maskAllText")] + bool MaskAllText { get; } + + // @required @property (readonly, nonatomic) BOOL maskAllImages; + [Abstract] + [Export ("maskAllImages")] + bool MaskAllImages { get; } + + // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull maskedViewClasses; + [Abstract] + [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + Class[] MaskedViewClasses { get; } + + // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; + [Abstract] + [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + Class[] UnmaskedViewClasses { get; } +} + +// @protocol SentryReplayBreadcrumbConverter +[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[Internal] +interface SentryReplayBreadcrumbConverter +{ + // @required -(id _Nullable)convertFrom:(SentryBreadcrumb * _Nonnull)breadcrumb __attribute__((warn_unused_result(""))); + [Abstract] + [Export ("convertFrom:")] + [return: NullAllowed] + SentryRRWebEvent ConvertFrom (SentryBreadcrumb breadcrumb); +} + +// @interface SentryReplayOptions : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] +[Internal] +interface SentryReplayOptions : SentryRedactOptions +{ + // @property (nonatomic) float sessionSampleRate; + [Export ("sessionSampleRate")] + float SessionSampleRate { get; set; } + + // @property (nonatomic) float onErrorSampleRate; + [Export ("onErrorSampleRate")] + float OnErrorSampleRate { get; set; } + + // @property (nonatomic) BOOL maskAllText; + [Export ("maskAllText")] + bool MaskAllText { get; set; } + + // @property (nonatomic) BOOL maskAllImages; + [Export ("maskAllImages")] + bool MaskAllImages { get; set; } + + // @property (nonatomic) enum SentryReplayQuality quality; + [Export ("quality", ArgumentSemantic.Assign)] + SentryReplayQuality Quality { get; set; } + + // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; + [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + Class[] MaskedViewClasses { get; set; } + + // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; + [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + Class[] UnmaskedViewClasses { get; set; } + + // @property (nonatomic) BOOL enableExperimentalViewRenderer __attribute__((deprecated("", "enableViewRendererV2"))); + [Export ("enableExperimentalViewRenderer")] + bool EnableExperimentalViewRenderer { get; set; } + + // @property (nonatomic) BOOL enableViewRendererV2; + [Export ("enableViewRendererV2")] + bool EnableViewRendererV2 { get; set; } + + // @property (nonatomic) BOOL enableFastViewRendering; + [Export ("enableFastViewRendering")] + bool EnableFastViewRendering { get; set; } + + // @property (readonly, nonatomic) NSInteger replayBitRate; + [Export ("replayBitRate")] + nint ReplayBitRate { get; } + + // @property (readonly, nonatomic) float sizeScale; + [Export ("sizeScale")] + float SizeScale { get; } + + // @property (nonatomic) NSUInteger frameRate; + [Export ("frameRate")] + nuint FrameRate { get; set; } + + // @property (nonatomic) NSTimeInterval errorReplayDuration; + [Export ("errorReplayDuration")] + double ErrorReplayDuration { get; set; } + + // @property (nonatomic) NSTimeInterval sessionSegmentDuration; + [Export ("sessionSegmentDuration")] + double SessionSegmentDuration { get; set; } + + // @property (nonatomic) NSTimeInterval maximumDuration; + [Export ("maximumDuration")] + double MaximumDuration { get; set; } + + // -(instancetype _Nonnull)initWithDictionary:(NSDictionary * _Nonnull)dictionary; + [Export ("initWithDictionary:")] + NativeHandle Constructor (NSDictionary dictionary); + + // -(instancetype _Nonnull)initWithSessionSampleRate:(float)sessionSampleRate onErrorSampleRate:(float)onErrorSampleRate maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages enableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering; + [Export ("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:enableViewRendererV2:enableFastViewRendering:")] + NativeHandle Constructor (float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages, bool enableViewRendererV2, bool enableFastViewRendering); +} + +// @interface SentrySDK : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] +[Internal] +interface SentrySDK +{ + // @property (readonly, nonatomic, strong, class) id _Nullable span; + [Static] + [NullAllowed, Export ("span", ArgumentSemantic.Strong)] + SentrySpan Span { get; } + + // @property (readonly, nonatomic, class) BOOL isEnabled; + [Static] + [Export ("isEnabled")] + bool IsEnabled { get; } + + // @property (readonly, nonatomic, strong, class) SentryReplayApi * _Nonnull replay; + [Static] + [Export ("replay", ArgumentSemantic.Strong)] + SentryReplayApi Replay { get; } + + // @property (readonly, nonatomic, strong, class) SentryLogger * _Nonnull logger; + [Static] + [Export ("logger", ArgumentSemantic.Strong)] + SentryLogger Logger { get; } + + // +(void)startWithOptions:(SentryOptions * _Nonnull)options; + [Static] + [Export ("startWithOptions:")] + void StartWithOptions (SentryOptions options); + + // +(void)startWithConfigureOptions:(void (^ _Nonnull)(SentryOptions * _Nonnull))configureOptions; + [Static] + [Export ("startWithConfigureOptions:")] + void StartWithConfigureOptions (Action configureOptions); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event; + [Static] + [Export ("captureEvent:")] + SentryId CaptureEvent (SentryEvent @event); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureEvent:withScope:")] + SentryId CaptureEvent (SentryEvent @event, SentryScope scope); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureEvent:withScopeBlock:")] + SentryId CaptureEvent (SentryEvent @event, Action block); + + // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation; + [Static] + [Export ("startTransactionWithName:operation:")] + SentrySpan StartTransactionWithName (string name, string operation); + + // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope; + [Static] + [Export ("startTransactionWithName:operation:bindToScope:")] + SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext; + [Static] + [Export ("startTransactionWithContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope; + [Static] + [Export ("startTransactionWithContext:bindToScope:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; + [Static] + [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; + [Static] + [Export ("startTransactionWithContext:customSamplingContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error; + [Static] + [Export ("captureError:")] + SentryId CaptureError (NSError error); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureError:withScope:")] + SentryId CaptureError (NSError error, SentryScope scope); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureError:withScopeBlock:")] + SentryId CaptureError (NSError error, Action block); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception; + [Static] + [Export ("captureException:")] + SentryId CaptureException (NSException exception); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureException:withScope:")] + SentryId CaptureException (NSException exception, SentryScope scope); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureException:withScopeBlock:")] + SentryId CaptureException (NSException exception, Action block); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message; + [Static] + [Export ("captureMessage:")] + SentryId CaptureMessage (string message); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureMessage:withScope:")] + SentryId CaptureMessage (string message, SentryScope scope); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureMessage:withScopeBlock:")] + SentryId CaptureMessage (string message, Action block); + + // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; + [Static] + [Export ("captureFeedback:")] + void CaptureFeedback (SentryFeedback feedback); + + // @property (readonly, nonatomic, strong, class) SentryFeedbackAPI * _Nonnull feedback __attribute__((availability(ios, introduced=13.0))); + [Static] + [Export ("feedback", ArgumentSemantic.Strong)] + SentryFeedbackAPI Feedback { get; } + + // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb; + [Static] + [Export ("addBreadcrumb:")] + void AddBreadcrumb (SentryBreadcrumb crumb); + + // +(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; + [Static] + [Export ("configureScope:")] + void ConfigureScope (Action callback); + + // @property (readonly, nonatomic, class) BOOL crashedLastRun; + [Static] + [Export ("crashedLastRun")] + bool CrashedLastRun { get; } + + // @property (readonly, nonatomic, class) BOOL detectedStartUpCrash; + [Static] + [Export ("detectedStartUpCrash")] + bool DetectedStartUpCrash { get; } + + // +(void)setUser:(SentryUser * _Nullable)user; + [Static] + [Export ("setUser:")] + void SetUser ([NullAllowed] SentryUser user); + + // +(void)startSession; + [Static] + [Export ("startSession")] + void StartSession (); + + // +(void)endSession; + [Static] + [Export ("endSession")] + void EndSession (); + + // +(void)crash; + [Static] + [Export ("crash")] + void Crash (); + + // +(void)reportFullyDisplayed; + [Static] + [Export ("reportFullyDisplayed")] + void ReportFullyDisplayed (); + + // +(void)pauseAppHangTracking; + [Static] + [Export ("pauseAppHangTracking")] + void PauseAppHangTracking (); + + // +(void)resumeAppHangTracking; + [Static] + [Export ("resumeAppHangTracking")] + void ResumeAppHangTracking (); + + // +(void)flush:(NSTimeInterval)timeout; + [Static] + [Export ("flush:")] + void Flush (double timeout); + + // +(void)close; + [Static] + [Export ("close")] + void Close (); + + // +(void)startProfiler; + [Static] + [Export ("startProfiler")] + void StartProfiler (); + + // +(void)stopProfiler; + [Static] + [Export ("stopProfiler")] + void StopProfiler (); + + // +(void)clearLogger; + [Static] + [Export ("clearLogger")] + void ClearLogger (); +} + +// @interface SentrySession : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] +[DisableDefaultCtor] +[Internal] +interface SentrySession +{ + // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); + [Export ("initWithReleaseName:distinctId:")] + [DesignatedInitializer] + NativeHandle Constructor (string releaseName, string distinctId); + + // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); + [Export ("initWithJSONObject:")] + [DesignatedInitializer] + NativeHandle Constructor (NSDictionary jsonObject); + + // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionExitedWithTimestamp:")] + void EndSessionExitedWithTimestamp (NSDate timestamp); + + // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionCrashedWithTimestamp:")] + void EndSessionCrashedWithTimestamp (NSDate timestamp); + + // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionAbnormalWithTimestamp:")] + void EndSessionAbnormalWithTimestamp (NSDate timestamp); + + // -(void)incrementErrors; + [Export ("incrementErrors")] + void IncrementErrors (); + + // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; + [Export ("sessionId", ArgumentSemantic.Copy)] + NSUuid SessionId { get; } + + // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; + [Export ("started", ArgumentSemantic.Copy)] + NSDate Started { get; } + + // @property (readonly, nonatomic) enum SentrySessionStatus status; + [Export ("status")] + SentrySessionStatus Status { get; } + + // @property (nonatomic) NSUInteger errors; + [Export ("errors")] + nuint Errors { get; set; } + + // @property (readonly, nonatomic) NSUInteger sequence; + [Export ("sequence")] + nuint Sequence { get; } + + // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; + [Export ("distinctId")] + string DistinctId { get; } + + // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; + [NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)] + NSNumber FlagInit { get; } + + // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; + [NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)] + NSDate Timestamp { get; } + + // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; + [NullAllowed, Export ("duration", ArgumentSemantic.Strong)] + NSNumber Duration { get; } + + // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; + [NullAllowed, Export ("releaseName")] + string ReleaseName { get; } + + // @property (copy, nonatomic) NSString * _Nullable environment; + [NullAllowed, Export ("environment")] + string Environment { get; set; } + + // @property (nonatomic, strong) SentryUser * _Nullable user; + [NullAllowed, Export ("user", ArgumentSemantic.Strong)] + SentryUser User { get; set; } + + // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; + [NullAllowed, Export ("abnormalMechanism")] + string AbnormalMechanism { get; set; } + + // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); + [Export ("serialize")] + NSDictionary Serialize(); + + // -(void)setFlagInit; + [Export ("setFlagInit")] + void SetFlagInit (); +} + +// @protocol SentryViewScreenshotProvider +[Protocol (Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[BaseType (typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[Internal] +interface SentryViewScreenshotProvider +{ + // @required -(void)imageWithView:(UIView * _Nonnull)view onComplete:(void (^ _Nonnull)(UIImage * _Nonnull))onComplete; + [Abstract] + [Export ("imageWithView:onComplete:")] + void OnComplete (UIView view, Action onComplete); +} + +// @interface SentryViewScreenshotOptions : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] +[Internal] +interface SentryViewScreenshotOptions : SentryRedactOptions +{ + // @property (nonatomic) BOOL enableViewRendererV2; + [Export ("enableViewRendererV2")] + bool EnableViewRendererV2 { get; set; } + + // @property (nonatomic) BOOL enableFastViewRendering; + [Export ("enableFastViewRendering")] + bool EnableFastViewRendering { get; set; } + + // @property (nonatomic) BOOL maskAllImages; + [Export ("maskAllImages")] + bool MaskAllImages { get; set; } + + // @property (nonatomic) BOOL maskAllText; + [Export ("maskAllText")] + bool MaskAllText { get; set; } + + // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; + [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + Class[] MaskedViewClasses { get; set; } + + // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; + [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + Class[] UnmaskedViewClasses { get; set; } + + // -(instancetype _Nonnull)initWithEnableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages maskedViewClasses:(NSArray * _Nonnull)maskedViewClasses unmaskedViewClasses:(NSArray * _Nonnull)unmaskedViewClasses __attribute__((objc_designated_initializer)); + [Export ("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] + [DesignatedInitializer] + NativeHandle Constructor (bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); +} + // @interface SentryScreenFrames : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -2243,6 +2827,7 @@ interface SentryScreenFrames [Internal] interface PrivateSentrySDKOnly { + // +(NSArray * _Nonnull)getDebugImages; [Static] [Export ("getDebugImages")] diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 8628626950..a13704f041 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -42,9 +42,7 @@ - - diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 9735003cd1..f1813ab486 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -66,3 +66,84 @@ internal enum SentrySpanStatus : ulong OutOfRange, DataLoss } + +[Native] +internal enum SentryANRType : long +{ + FatalFullyBlocking = 0, + FatalNonFullyBlocking = 1, + FullyBlocking = 2, + NonFullyBlocking = 3, + Unknown = 4 +} + +[Native] +internal enum SentryFeedbackSource : long +{ + Widget = 0, + Custom = 1 +} + +[Native] +internal enum SentryLevel : ulong +{ + None = 0, + Debug = 1, + Info = 2, + Warning = 3, + Error = 4, + Fatal = 5 +} + +[Native] +internal enum SentryStructuredLogLevel : long +{ + Trace = 0, + Debug = 1, + Info = 2, + Warn = 3, + Error = 4, + Fatal = 5 +} + +[Native] +internal enum SentryProfileLifecycle : long +{ + Manual = 0, + Trace = 1 +} + +[Native] +internal enum SentryReplayQuality : long +{ + Low = 0, + Medium = 1, + High = 2 +} + +[Native] +internal enum SentryReplayType : long +{ + Session = 0, + Buffer = 1 +} + +[Native] +internal enum SentrySessionStatus : ulong +{ + Ok = 0, + Exited = 1, + Crashed = 2, + Abnormal = 3 +} + +[Native] +internal enum SentryTransactionNameSource : long +{ + Custom = 0, + Url = 1, + Route = 2, + View = 3, + Component = 4, + Task = 5 +} diff --git a/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs deleted file mode 100644 index 1bf7b8ded4..0000000000 --- a/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs +++ /dev/null @@ -1,893 +0,0 @@ -/* - * This file defines iOS API contracts for the members we need from Sentry-Swift.h - * Note that we are **not** using Objective Sharpie to generate contracts (instead they're maintained manually). - */ -using System; -using Foundation; -using ObjCRuntime; -using UIKit; - -namespace Sentry.CocoaSdk; - -[BaseType(typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] -[DisableDefaultCtor] // Marks the default constructor as unavailable -[Internal] -interface SentryFeedback -{ - [Export("name", ArgumentSemantic.Copy)] - string Name { get; set; } - - [Export("email", ArgumentSemantic.Copy)] - string Email { get; set; } - - [Export("message", ArgumentSemantic.Copy)] - string Message { get; set; } - - [Export("source")] - SentryFeedbackSource Source { get; set; } - - [Export("eventId", ArgumentSemantic.Strong)] - SentryId EventId { get; } - - [Export("associatedEventId", ArgumentSemantic.Strong)] - SentryId AssociatedEventId { get; set; } - - [Export("initWithMessage:name:email:source:associatedEventId:attachments:")] - [DesignatedInitializer] - IntPtr Constructor(string message, [NullAllowed] string name, [NullAllowed] string email, SentryFeedbackSource source, [NullAllowed] SentryId associatedEventId, [NullAllowed] NSData[] attachments); -} - -// @interface SentryId : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] -[Internal] -interface SentryId -{ - // @property (nonatomic, strong, class) SentryId * _Nonnull empty; - [Static] - [Export ("empty", ArgumentSemantic.Strong)] - SentryId Empty { get; set; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; - [Export ("sentryIdString")] - string SentryIdString { get; } - - // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); - [Export ("initWithUuid:")] - [DesignatedInitializer] - NativeHandle Constructor (NSUuid uuid); - - // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); - [Export ("initWithUUIDString:")] - [DesignatedInitializer] - NativeHandle Constructor (string uuidString); - - // @property (readonly, nonatomic) NSUInteger hash; - [Export ("hash")] - nuint Hash { get; } -} - -// @interface SentryLog : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] -[DisableDefaultCtor] -[Internal] -interface SentryLog -{ - // @property (copy, nonatomic) NSDate * _Nonnull timestamp; - [Export ("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; set; } - - // @property (nonatomic, strong) SentryId * _Nonnull traceId; - [Export ("traceId", ArgumentSemantic.Strong)] - SentryId TraceId { get; set; } - - // @property (nonatomic) enum SentryStructuredLogLevel level; - [Export ("level", ArgumentSemantic.Assign)] - SentryStructuredLogLevel Level { get; set; } - - // @property (copy, nonatomic) NSString * _Nonnull body; - [Export ("body")] - string Body { get; set; } - - // @property (copy, nonatomic) NSDictionary * _Nonnull attributes; - [Export ("attributes", ArgumentSemantic.Copy)] - NSDictionary Attributes { get; set; } - - // @property (nonatomic, strong) NSNumber * _Nullable severityNumber; - [NullAllowed, Export ("severityNumber", ArgumentSemantic.Strong)] - NSNumber SeverityNumber { get; set; } -} - -// @interface SentryLogger : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry12SentryLogger")] -[DisableDefaultCtor] -[Internal] -interface SentryLogger -{ - // -(void)trace:(NSString * _Nonnull)body; - [Export ("trace:")] - void Trace (string body); - - // -(void)trace:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("trace:attributes:")] - void Trace (string body, NSDictionary attributes); - - // -(void)debug:(NSString * _Nonnull)body; - [Export ("debug:")] - void Debug (string body); - - // -(void)debug:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("debug:attributes:")] - void Debug (string body, NSDictionary attributes); - - // -(void)info:(NSString * _Nonnull)body; - [Export ("info:")] - void Info (string body); - - // -(void)info:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("info:attributes:")] - void Info (string body, NSDictionary attributes); - - // -(void)warn:(NSString * _Nonnull)body; - [Export ("warn:")] - void Warn (string body); - - // -(void)warn:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("warn:attributes:")] - void Warn (string body, NSDictionary attributes); - - // -(void)error:(NSString * _Nonnull)body; - [Export ("error:")] - void Error (string body); - - // -(void)error:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("error:attributes:")] - void Error (string body, NSDictionary attributes); - - // -(void)fatal:(NSString * _Nonnull)body; - [Export ("fatal:")] - void Fatal (string body); - - // -(void)fatal:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("fatal:attributes:")] - void Fatal (string body, NSDictionary attributes); -} - -// @interface SentryProfileOptions : NSObject -[BaseType(typeof(NSObject), Name = "_TtC6Sentry20SentryProfileOptions")] -[DisableDefaultCtor] -[Internal] -interface SentryProfileOptions -{ - // @property(nonatomic) enum SentryProfileLifecycle lifecycle; - [Export("lifecycle", ArgumentSemantic.Assign)] - SentryProfileLifecycle Lifecycle { get; set; } - - // @property(nonatomic) float sessionSampleRate; - [Export("sessionSampleRate")] - float SessionSampleRate { get; set; } - - // @property(nonatomic) BOOL profileAppStarts; - [Export("profileAppStarts")] - bool ProfileAppStarts { get; set; } - - // - (nonnull instancetype) init OBJC_DESIGNATED_INITIALIZER; - [Export("init")] - [DesignatedInitializer] - NativeHandle Constructor(); -} - -// @interface SentrySessionReplayIntegration : SentryBaseIntegration -[BaseType (typeof(NSObject))] -[Internal] -interface SentrySessionReplayIntegration -{ - // -(instancetype _Nonnull)initForManualUse:(SentryOptions * _Nonnull)options; - [Export ("initForManualUse:")] - NativeHandle Constructor (SentryOptions options); - // -(BOOL)captureReplay; - [Export ("captureReplay")] - bool CaptureReplay(); - // -(void)configureReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; - [Export ("configureReplayWith:screenshotProvider:")] - void ConfigureReplayWith ([NullAllowed] SentryReplayBreadcrumbConverter breadcrumbConverter, [NullAllowed] SentryViewScreenshotProvider screenshotProvider); - // -(void)pause; - [Export ("pause")] - void Pause (); - // -(void)resume; - [Export ("resume")] - void Resume (); - // -(void)stop; - [Export ("stop")] - void Stop (); - // -(void)start; - [Export ("start")] - void Start (); - // +(id _Nonnull)createBreadcrumbwithTimestamp:(NSDate * _Nonnull)timestamp category:(NSString * _Nonnull)category message:(NSString * _Nullable)message level:(enum SentryLevel)level data:(NSDictionary * _Nullable)data; - [Static] - [Export ("createBreadcrumbwithTimestamp:category:message:level:data:")] - SentryRRWebEvent CreateBreadcrumbwithTimestamp (NSDate timestamp, string category, [NullAllowed] string message, SentryLevel level, [NullAllowed] NSDictionary data); - // +(id _Nonnull)createNetworkBreadcrumbWithTimestamp:(NSDate * _Nonnull)timestamp endTimestamp:(NSDate * _Nonnull)endTimestamp operation:(NSString * _Nonnull)operation description:(NSString * _Nonnull)description data:(NSDictionary * _Nonnull)data; - [Static] - [Export ("createNetworkBreadcrumbWithTimestamp:endTimestamp:operation:description:data:")] - SentryRRWebEvent CreateNetworkBreadcrumbWithTimestamp (NSDate timestamp, NSDate endTimestamp, string operation, string description, NSDictionary data); - // +(id _Nonnull)createDefaultBreadcrumbConverter; - [Static] - [Export ("createDefaultBreadcrumbConverter")] - SentryReplayBreadcrumbConverter CreateDefaultBreadcrumbConverter(); -} - -[Protocol(Name = "_TtP6Sentry19SentryRedactOptions_")] -[Model] -[BaseType(typeof(NSObject))] -[Internal] -internal interface SentryRedactOptions -{ - [Abstract] - [Export("maskAllText")] - bool MaskAllText { get; } - - [Abstract] - [Export("maskAllImages")] - bool MaskAllImages { get; } - - [Abstract] - [Export("maskedViewClasses", ArgumentSemantic.Copy)] - Class[] MaskedViewClasses { get; } - - [Abstract] - [Export("unmaskedViewClasses", ArgumentSemantic.Copy)] - Class[] UnmaskedViewClasses { get; } -} - -// @protocol SentryReplayBreadcrumbConverter -[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] -[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] -[Model] -[Internal] -interface SentryReplayBreadcrumbConverter -{ - // @required -(id _Nullable)convertFrom:(SentryBreadcrumb * _Nonnull)breadcrumb __attribute__((warn_unused_result(""))); - [Abstract] - [Export ("convertFrom:")] - [return: NullAllowed] - SentryRRWebEvent ConvertFrom (SentryBreadcrumb breadcrumb); -} - -// @interface SentryReplayOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] -[Internal] -interface SentryReplayOptions //: ISentryRedactOptions -{ - // @property (nonatomic) float sessionSampleRate; - [Export ("sessionSampleRate")] - float SessionSampleRate { get; set; } - // @property (nonatomic) float onErrorSampleRate; - [Export ("onErrorSampleRate")] - float OnErrorSampleRate { get; set; } - // @property (nonatomic) BOOL maskAllText; - [Export ("maskAllText")] - bool MaskAllText { get; set; } - // @property (nonatomic) BOOL maskAllImages; - [Export ("maskAllImages")] - bool MaskAllImages { get; set; } - // @property (nonatomic) enum SentryReplayQuality quality; - [Export ("quality", ArgumentSemantic.Assign)] - SentryReplayQuality Quality { get; set; } - /* - // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; - //[Export ("maskedViewClasses", ArgumentSemantic.Copy)] - //Class[] MaskedViewClasses { get; set; } - // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; - //[Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] - //Class[] UnmaskedViewClasses { get; set; } - // @property (readonly, nonatomic) NSInteger replayBitRate; - [Export ("replayBitRate")] - nint ReplayBitRate { get; } - // @property (readonly, nonatomic) float sizeScale; - [Export ("sizeScale")] - float SizeScale { get; } - // @property (nonatomic) NSUInteger frameRate; - [Export ("frameRate")] - nuint FrameRate { get; set; } - // @property (readonly, nonatomic) NSTimeInterval errorReplayDuration; - [Export ("errorReplayDuration")] - double ErrorReplayDuration { get; } - // @property (readonly, nonatomic) NSTimeInterval sessionSegmentDuration; - [Export ("sessionSegmentDuration")] - double SessionSegmentDuration { get; } - // @property (readonly, nonatomic) NSTimeInterval maximumDuration; - [Export ("maximumDuration")] - double MaximumDuration { get; } - // -(instancetype _Nonnull)initWithSessionSampleRate:(float)sessionSampleRate onErrorSampleRate:(float)onErrorSampleRate maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages __attribute__((objc_designated_initializer)); - [Export ("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:")] - [DesignatedInitializer] - NativeHandle Constructor (float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages); - // -(instancetype _Nonnull)initWithDictionary:(NSDictionary * _Nonnull)dictionary; - [Export ("initWithDictionary:")] - NativeHandle Constructor (NSDictionary dictionary); - */ -} - -// @interface SentryRRWebEvent : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] -[Protocol] -[Model] -[DisableDefaultCtor] -[Internal] -interface SentryRRWebEvent : SentrySerializable -{ - // @property (readonly, nonatomic) enum SentryRRWebEventType type; - [Export ("type")] - SentryRRWebEventType Type { get; } - // @property (readonly, copy, nonatomic) NSDate * _Nonnull timestamp; - [Export ("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; } - // @property (readonly, copy, nonatomic) NSDictionary * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Copy)] - NSDictionary Data { get; } - // -(instancetype _Nonnull)initWithType:(enum SentryRRWebEventType)type timestamp:(NSDate * _Nonnull)timestamp data:(NSDictionary * _Nullable)data __attribute__((objc_designated_initializer)); - [Export ("initWithType:timestamp:data:")] - [DesignatedInitializer] - NativeHandle Constructor (SentryRRWebEventType type, NSDate timestamp, [NullAllowed] NSDictionary data); -} - -// @interface SentrySDK : NSObject -[BaseType(typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] -[DisableDefaultCtor] -[Internal] -interface SentrySDK -{ - // @property (readonly, nonatomic, strong, class) id _Nullable span; - [Static] - [NullAllowed, Export ("span", ArgumentSemantic.Strong)] - SentrySpan Span { get; } - - // @property (readonly, nonatomic, class) BOOL isEnabled; - [Static] - [Export ("isEnabled")] - bool IsEnabled { get; } - - // @property (readonly, nonatomic, strong, class) SentryReplayApi * _Nonnull replay; - [Static] - [Export ("replay", ArgumentSemantic.Strong)] - SentryReplayApi Replay { get; } - - // @property (readonly, nonatomic, strong, class) SentryLogger * _Nonnull logger; - [Static] - [Export ("logger", ArgumentSemantic.Strong)] - SentryLogger Logger { get; } - - // +(void)startWithOptions:(SentryOptions * _Nonnull)options; - [Static] - [Export ("startWithOptions:")] - void StartWithOptions (SentryOptions options); - - // +(void)startWithConfigureOptions:(void (^ _Nonnull)(SentryOptions * _Nonnull))configureOptions; - [Static] - [Export ("startWithConfigureOptions:")] - void StartWithConfigureOptions (Action configureOptions); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event; - [Static] - [Export ("captureEvent:")] - SentryId CaptureEvent (SentryEvent @event); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope; - [Static] - [Export ("captureEvent:withScope:")] - SentryId CaptureEvent (SentryEvent @event, SentryScope scope); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; - [Static] - [Export ("captureEvent:withScopeBlock:")] - SentryId CaptureEvent (SentryEvent @event, Action block); - - // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation; - [Static] - [Export ("startTransactionWithName:operation:")] - SentrySpan StartTransactionWithName (string name, string operation); - - // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope; - [Static] - [Export ("startTransactionWithName:operation:bindToScope:")] - SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext; - [Static] - [Export ("startTransactionWithContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope; - [Static] - [Export ("startTransactionWithContext:bindToScope:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; - [Static] - [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; - [Static] - [Export ("startTransactionWithContext:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error; - [Static] - [Export ("captureError:")] - SentryId CaptureError (NSError error); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope; - [Static] - [Export ("captureError:withScope:")] - SentryId CaptureError (NSError error, SentryScope scope); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; - [Static] - [Export ("captureError:withScopeBlock:")] - SentryId CaptureError (NSError error, Action block); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception; - [Static] - [Export ("captureException:")] - SentryId CaptureException (NSException exception); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope; - [Static] - [Export ("captureException:withScope:")] - SentryId CaptureException (NSException exception, SentryScope scope); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; - [Static] - [Export ("captureException:withScopeBlock:")] - SentryId CaptureException (NSException exception, Action block); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message; - [Static] - [Export ("captureMessage:")] - SentryId CaptureMessage (string message); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope; - [Static] - [Export ("captureMessage:withScope:")] - SentryId CaptureMessage (string message, SentryScope scope); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; - [Static] - [Export ("captureMessage:withScopeBlock:")] - SentryId CaptureMessage (string message, Action block); - - // +(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((deprecated("Use SentrySDK.back or use or configure our new managed UX with SentryOptions.configureUserFeedback."))); - [Static] - [Export ("captureUserFeedback:")] - void CaptureUserFeedback (SentryUserFeedback userFeedback); - - // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; - [Static] - [Export ("captureFeedback:")] - void CaptureFeedback (SentryFeedback feedback); - - // @property (readonly, nonatomic, strong, class) SentryFeedbackAPI * _Nonnull feedback __attribute__((availability(ios, introduced=13.0))); - [Static] - [Export ("feedback", ArgumentSemantic.Strong)] - SentryFeedbackAPI Feedback { get; } - - // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb; - [Static] - [Export ("addBreadcrumb:")] - void AddBreadcrumb (SentryBreadcrumb crumb); - - // +(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; - [Static] - [Export ("configureScope:")] - void ConfigureScope (Action callback); - - // @property (readonly, nonatomic, class) BOOL crashedLastRun; - [Static] - [Export ("crashedLastRun")] - bool CrashedLastRun { get; } - - // @property (readonly, nonatomic, class) BOOL detectedStartUpCrash; - [Static] - [Export ("detectedStartUpCrash")] - bool DetectedStartUpCrash { get; } - - // +(void)setUser:(SentryUser * _Nullable)user; - [Static] - [Export ("setUser:")] - void SetUser ([NullAllowed] SentryUser user); - - // +(void)startSession; - [Static] - [Export ("startSession")] - void StartSession (); - - // +(void)endSession; - [Static] - [Export ("endSession")] - void EndSession (); - - // +(void)crash; - [Static] - [Export ("crash")] - void Crash (); - - // +(void)reportFullyDisplayed; - [Static] - [Export ("reportFullyDisplayed")] - void ReportFullyDisplayed (); - - // +(void)pauseAppHangTracking; - [Static] - [Export ("pauseAppHangTracking")] - void PauseAppHangTracking (); - - // +(void)resumeAppHangTracking; - [Static] - [Export ("resumeAppHangTracking")] - void ResumeAppHangTracking (); - - // +(void)flush:(NSTimeInterval)timeout; - [Static] - [Export ("flush:")] - void Flush (double timeout); - - // +(void)close; - [Static] - [Export ("close")] - void Close (); - - // +(void)startProfiler; - [Static] - [Export ("startProfiler")] - void StartProfiler (); - - // +(void)stopProfiler; - [Static] - [Export ("stopProfiler")] - void StopProfiler (); - - // +(void)clearLogger; - [Static] - [Export ("clearLogger")] - void ClearLogger (); -} - -// @interface SentrySession : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] -[DisableDefaultCtor] -[Internal] -interface SentrySession -{ - // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); - [Export ("initWithReleaseName:distinctId:")] - [DesignatedInitializer] - NativeHandle Constructor (string releaseName, string distinctId); - - // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); - [Export ("initWithJSONObject:")] - [DesignatedInitializer] - NativeHandle Constructor (NSDictionary jsonObject); - - // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionExitedWithTimestamp:")] - void EndSessionExitedWithTimestamp (NSDate timestamp); - - // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionCrashedWithTimestamp:")] - void EndSessionCrashedWithTimestamp (NSDate timestamp); - - // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionAbnormalWithTimestamp:")] - void EndSessionAbnormalWithTimestamp (NSDate timestamp); - - // -(void)incrementErrors; - [Export ("incrementErrors")] - void IncrementErrors (); - - // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; - [Export ("sessionId", ArgumentSemantic.Copy)] - NSUuid SessionId { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; - [Export ("started", ArgumentSemantic.Copy)] - NSDate Started { get; } - - // @property (readonly, nonatomic) enum SentrySessionStatus status; - [Export ("status")] - SentrySessionStatus Status { get; } - - // @property (nonatomic) NSUInteger errors; - [Export ("errors")] - nuint Errors { get; set; } - - // @property (readonly, nonatomic) NSUInteger sequence; - [Export ("sequence")] - nuint Sequence { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; - [Export ("distinctId")] - string DistinctId { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; - [NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)] - NSNumber FlagInit { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; - [NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; - [NullAllowed, Export ("duration", ArgumentSemantic.Strong)] - NSNumber Duration { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] - string ReleaseName { get; } - - // @property (copy, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] - string Environment { get; set; } - - // @property (nonatomic, strong) SentryUser * _Nullable user; - [NullAllowed, Export ("user", ArgumentSemantic.Strong)] - SentryUser User { get; set; } - - // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; - [NullAllowed, Export ("abnormalMechanism")] - string AbnormalMechanism { get; set; } - - // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); - [Export ("serialize")] - NSDictionary Serialize(); - - // -(void)setFlagInit; - [Export ("setFlagInit")] - void SetFlagInit (); - - // -(id _Nonnull)copyWithZone:(struct _NSZone * _Nullable)zone __attribute__((warn_unused_result(""))); - // [Export ("copyWithZone:")] - // unsafe NSObject CopyWithZone ([NullAllowed] _NSZone* zone); -} - -// @interface SentryUserFeedback : NSObject -[BaseType(typeof(NSObject))] -[DisableDefaultCtor] -[Internal] -interface SentryUserFeedback : SentrySerializable -{ - // @property (nonatomic, readonly, strong) SentryId * _Nonnull eventId; - [Export("eventId", ArgumentSemantic.Strong)] - SentryId EventId { get; } - - // @property (nonatomic, copy) NSString * _Nonnull name; - [Export("name")] - string Name { get; set; } - - // @property (nonatomic, copy) NSString * _Nonnull email; - [Export("email")] - string Email { get; set; } - - // @property (nonatomic, copy) NSString * _Nonnull comments; - [Export("comments")] - string Comments { get; set; } - - // - (nonnull instancetype)initWithEventId:(SentryId * _Nonnull)eventId OBJC_DESIGNATED_INITIALIZER; - [Export("initWithEventId:")] - NativeHandle Constructor(SentryId eventId); -} - -[BaseType(typeof(NSObject), Name = "_TtC6Sentry31SentryUserFeedbackConfiguration")] -[DisableDefaultCtor] -[Internal] -interface SentryUserFeedbackConfiguration -{ - [Export("animations")] - bool Animations { get; set; } - - [NullAllowed, Export("configureWidget", ArgumentSemantic.Copy)] - Action ConfigureWidget { get; set; } - - [Export("widgetConfig", ArgumentSemantic.Strong)] - SentryUserFeedbackWidgetConfiguration WidgetConfig { get; set; } - - [Export("useShakeGesture")] - bool UseShakeGesture { get; set; } - - [Export("showFormForScreenshots")] - bool ShowFormForScreenshots { get; set; } - - // [NullAllowed, Export("configureForm", ArgumentSemantic.Copy)] - // Action ConfigureForm { get; set; } - - // [Export("formConfig", ArgumentSemantic.Strong)] - // SentryUserFeedbackFormConfiguration FormConfig { get; set; } - - [NullAllowed, Export("tags", ArgumentSemantic.Copy)] - NSDictionary Tags { get; set; } - - [NullAllowed, Export("onFormOpen", ArgumentSemantic.Copy)] - Action OnFormOpen { get; set; } - - [NullAllowed, Export("onFormClose", ArgumentSemantic.Copy)] - Action OnFormClose { get; set; } - - [NullAllowed, Export("onSubmitSuccess", ArgumentSemantic.Copy)] - Action> OnSubmitSuccess { get; set; } - - [NullAllowed, Export("onSubmitError", ArgumentSemantic.Copy)] - Action OnSubmitError { get; set; } - - // [NullAllowed, Export("configureTheme", ArgumentSemantic.Copy)] - // Action ConfigureTheme { get; set; } - // - // [Export("theme", ArgumentSemantic.Strong)] - // SentryUserFeedbackThemeConfiguration Theme { get; set; } - // - // [NullAllowed, Export("configureDarkTheme", ArgumentSemantic.Copy)] - // Action ConfigureDarkTheme { get; set; } - // - // [Export("darkTheme", ArgumentSemantic.Strong)] - // SentryUserFeedbackThemeConfiguration DarkTheme { get; set; } - - [Export("textEffectiveHeightCenter")] - nfloat TextEffectiveHeightCenter { get; set; } - - [Export("scaleFactor")] - nfloat ScaleFactor { get; set; } - - [Export("calculateScaleFactor")] - nfloat CalculateScaleFactor(); - - [Export("paddingScaleFactor")] - nfloat PaddingScaleFactor { get; set; } - - [Export("calculatePaddingScaleFactor")] - nfloat CalculatePaddingScaleFactor(); - - [Export("recalculateScaleFactors")] - void RecalculateScaleFactors(); - - [Export("padding")] - nfloat Padding { get; } - - [Export("spacing")] - nfloat Spacing { get; } - - [Export("margin")] - nfloat Margin { get; } - - [Export("init")] - [DesignatedInitializer] - IntPtr Constructor(); -} - -// [BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackThemeConfiguration")] -// [DisableDefaultCtor] -// [Internal] -// interface SentryUserFeedbackThemeConfiguration -// { -// [Export("backgroundColor", ArgumentSemantic.Strong)] -// UIColor BackgroundColor { get; set; } -// -// [Export("textColor", ArgumentSemantic.Strong)] -// UIColor TextColor { get; set; } -// -// [Export("buttonColor", ArgumentSemantic.Strong)] -// UIColor ButtonColor { get; set; } -// -// [Export("buttonTextColor", ArgumentSemantic.Strong)] -// UIColor ButtonTextColor { get; set; } -// -// [Export("init")] -// [DesignatedInitializer] -// IntPtr Constructor(); -// } - -[BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackWidgetConfiguration")] -[DisableDefaultCtor] -[Internal] -interface SentryUserFeedbackWidgetConfiguration -{ - [Export("autoInject")] - bool AutoInject { get; set; } - - [Export("defaultLabelText", ArgumentSemantic.Copy)] - string DefaultLabelText { get; } - - [NullAllowed, Export("labelText", ArgumentSemantic.Copy)] - string LabelText { get; set; } - - [Export("showIcon")] - bool ShowIcon { get; set; } - - [NullAllowed, Export("widgetAccessibilityLabel", ArgumentSemantic.Copy)] - string WidgetAccessibilityLabel { get; set; } - - [Export("windowLevel")] - nfloat WindowLevel { get; set; } - - [Export("location")] - NSDirectionalRectEdge Location { get; set; } - - [Export("layoutUIOffset")] - UIOffset LayoutUIOffset { get; set; } - - [Export("init")] - [DesignatedInitializer] - IntPtr Constructor(); -} - - -// [BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackFormConfiguration")] -// [DisableDefaultCtor] -// [Internal] -// interface SentryUserFeedbackFormConfiguration -// { -// [Export("title", ArgumentSemantic.Copy)] -// string Title { get; set; } -// -// [Export("subtitle", ArgumentSemantic.Copy)] -// string Subtitle { get; set; } -// -// [Export("submitButtonTitle", ArgumentSemantic.Copy)] -// string SubmitButtonTitle { get; set; } -// -// [Export("cancelButtonTitle", ArgumentSemantic.Copy)] -// string CancelButtonTitle { get; set; } -// -// [Export("thankYouMessage", ArgumentSemantic.Copy)] -// string ThankYouMessage { get; set; } -// -// [Export("init")] -// [DesignatedInitializer] -// IntPtr Constructor(); -// } - -// @interface SentryViewScreenshotOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] -[Internal] -interface SentryViewScreenshotOptions //: ISentryRedactOptions -{ - // @property (nonatomic) BOOL enableViewRendererV2; - [Export ("enableViewRendererV2")] - bool EnableViewRendererV2 { get; set; } - - // @property (nonatomic) BOOL enableFastViewRendering; - [Export ("enableFastViewRendering")] - bool EnableFastViewRendering { get; set; } - - // @property (nonatomic) BOOL maskAllImages; - [Export ("maskAllImages")] - bool MaskAllImages { get; set; } - - // @property (nonatomic) BOOL maskAllText; - [Export ("maskAllText")] - bool MaskAllText { get; set; } - - // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; - [Export ("maskedViewClasses", ArgumentSemantic.Copy)] - Class[] MaskedViewClasses { get; set; } - - // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; - [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] - Class[] UnmaskedViewClasses { get; set; } - - // -(instancetype _Nonnull)initWithEnableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages maskedViewClasses:(NSArray * _Nonnull)maskedViewClasses unmaskedViewClasses:(NSArray * _Nonnull)unmaskedViewClasses __attribute__((objc_designated_initializer)); - [Export ("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] - [DesignatedInitializer] - NativeHandle Constructor (bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); -} - -// @protocol SentryViewScreenshotProvider -[Protocol (Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] -[Model] -[BaseType (typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] -[Internal] -interface SentryViewScreenshotProvider -{ - // @required -(void)imageWithView:(UIView * _Nonnull)view onComplete:(void (^ _Nonnull)(UIImage * _Nonnull))onComplete; - [Abstract] - [Export ("imageWithView:onComplete:")] - void OnComplete (UIView view, Action onComplete); -} diff --git a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs deleted file mode 100644 index 1453151744..0000000000 --- a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file defines iOS API contracts for enums we need from Sentry-Swift.h. - * Note that we are **not** using Objective Sharpie to generate these contracts (instead they're maintained manually). - */ -using System.Runtime.InteropServices; -using Foundation; -using ObjCRuntime; -using Sentry; - -namespace Sentry.CocoaSdk; - -[Native] -internal enum SentryFeedbackSource : long -{ - Widget = 0, - Custom = 1 -} - -[Native] -internal enum SentryLevel : ulong -{ - None = 0, - Debug = 1, - Info = 2, - Warning = 3, - Error = 4, - Fatal = 5 -} - -[Native] -internal enum SentryStructuredLogLevel : long -{ - Trace = 0, - Debug = 1, - Info = 2, - Warn = 3, - Error = 4, - Fatal = 5 -} - -[Native] -internal enum SentryProfileLifecycle : long -{ - Manual = 0, - Trace = 1 -} - -[Native] -internal enum SentryReplayQuality : long -{ - Low = 0, - Medium = 1, - High = 2 -} - -[Native] -internal enum SentryReplayType : long -{ - Session = 0, - Buffer = 1 -} - -[Native] -internal enum SentryRRWebEventType : long -{ - None = 0, - Touch = 3, - Meta = 4, - Custom = 5 -} - -[Native] -internal enum SentrySessionStatus : ulong -{ - Ok = 0, - Exited = 1, - Crashed = 2, - Abnormal = 3 -} - -[Native] -internal enum SentryTransactionNameSource : long -{ - Custom = 0, - Url = 1, - Route = 2, - View = 3, - Component = 4, - Task = 5 -} diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs new file mode 100644 index 0000000000..53dfb78d00 --- /dev/null +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -0,0 +1,132 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +if (args.Length != 1) +{ + Console.Error.WriteLine("Usage: Sentry.Bindings.Cocoa.PostProcessor "); + return; +} + +var code = File.ReadAllText(args[0]); +var tree = CSharpSyntaxTree.ParseText(code); +var nodes = tree.GetCompilationUnitRoot() + .Blacklist( + // NSObject + "IsEqual", + "CopyWithZone", + // PrivateSentrySDKOnly + "StoreEnvelope", + "CaptureEnvelope", + "EnvelopeWithData", + // SentryOptions + "CaptureUserFeedback" + ) + .Blacklist( + "SentryUserFeedbackConfigurationBlock" + ) + .Blacklist( + "ConfigureUserFeedback", + "Description", + "EnableMetricKitRawPayload", + "AppStartMeasurement", + "AppStartMeasurementTimeoutInterval", + "OnAppStartMeasurementAvailable", + "SentryExperimentalOptions", + "SpanDescription" + ) + .Whitelist( + "Constants", + "ISentryRRWebEvent", + "PrivateSentrySDKOnly", + "SentryAttachment", + "SentryBaggage", + "SentryBreadcrumb", + "SentryClient", + "SentryDebugImageProvider", + "SentryDebugMeta", + "SentryDsn", + "SentryEvent", + "SentryException", + "SentryFeedback", + "SentryFeedbackAPI", + "SentryFrame", + "SentryGeo", + "SentryHttpStatusCodeRange", + "SentryHub", + "SentryId", + "SentryIntegrationProtocol", + "SentryLog", + "SentryLogger", + "SentryMeasurementUnit", + "SentryMeasurementUnitDuration", + "SentryMeasurementUnitFraction", + "SentryMeasurementUnitInformation", + "SentryMechanism", + "SentryMechanismMeta", + "SentryMessage", + "SentryNSError", + "SentryOptions", + "SentryProfileOptions", + "SentryRedactOptions", + "SentryReplayApi", + "SentryReplayBreadcrumbConverter", + "SentryReplayOptions", + "SentryRequest", + "SentryRRWebEvent", + "SentrySamplingContext", + "SentryScope", + "SentryScreenFrames", + "SentrySDK", + "SentrySerializable", + "SentrySession", + "SentrySpan", + "SentrySpanContext", + "SentrySpanId", + "SentryStacktrace", + "SentryThread", + "SentryTraceContext", + "SentryTraceHeader", + "SentryTransactionContext", + "SentryUser", + "SentryViewScreenshotOptions", + "SentryViewScreenshotProvider" + ); +File.WriteAllText(args[0], nodes.ToFullString()); + +internal static class FilterExtensions +{ + private static string GetIdentifier(SyntaxNode node) + { + return node switch + { + TypeDeclarationSyntax type => type.Identifier.Text, + DelegateDeclarationSyntax del => del.Identifier.Text, + MethodDeclarationSyntax method => method.Identifier.Text, + PropertyDeclarationSyntax property => property.Identifier.Text, + _ => throw new NotSupportedException(node.GetType().Name) + }; + } + + public static CompilationUnitSyntax Blacklist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nameSet = new HashSet(names); + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => nameSet.Contains(GetIdentifier(node))); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } + + public static CompilationUnitSyntax Whitelist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nameSet = new HashSet(names); + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => !nameSet.Contains(GetIdentifier(node))); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } +} diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj new file mode 100644 index 0000000000..cd9e9995be --- /dev/null +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj @@ -0,0 +1,14 @@ + + + + Exe + net9.0 + enable + enable + + + + + + + From 28efafc311e05744296115c7bc2f9df5a758adb9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 09:47:07 +0100 Subject: [PATCH 02/36] Fix Xcode 26 --- scripts/generate-cocoa-bindings.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 2faea90a52..fc896d8685 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -106,6 +106,8 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ $XcodePath = (xcode-select -p) -replace '/Contents/Developer$', '' $iPhoneSdkVersion = sharpie xcode -xcode $XcodePath -sdks | grep -o -m 1 'iphoneos\S*' Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" +$iPhoneSdkPath = xcrun --show-sdk-path --sdk $iPhoneSdkVersion +Write-Output "iPhoneSdkPath: $iPhoneSdkPath" ## Imports in the various header files are provided in the "new" style of: # `#import ` @@ -168,7 +170,8 @@ sharpie bind -sdk $iPhoneSdkVersion ` "$HeadersPath/Sentry-Swift.h" ` "$PrivateHeadersPath/PrivateSentrySDKOnly.h" ` -o $BindingsPath ` - -c -Wno-objc-property-no-attribute + -c -Wno-objc-property-no-attribute ` + -F"$iPhoneSdkPath/System/Library/SubFrameworks" # needed for UIUtilities.framework in Xcode 26+ # Ensure backup path exists if (!(Test-Path $BackupPath)) From 9a504f3c3799506d0e871451b490cfbfac03e898 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 12:00:02 +0100 Subject: [PATCH 03/36] Support wildcards --- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 24 ++--- .../Program.cs | 87 ++++++++++++++----- 2 files changed, 80 insertions(+), 31 deletions(-) diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 4ef7a50273..8942f1fee8 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -719,6 +719,10 @@ interface SentrySpanContext : SentrySerializable [Export ("operation")] string Operation { get; } + // @property (readonly, copy, nonatomic) NSString * _Nullable spanDescription; + [NullAllowed, Export ("spanDescription")] + string SpanDescription { get; } + // @property (copy, nonatomic) NSString * _Nonnull origin; [Export ("origin")] string Origin { get; set; } @@ -777,6 +781,11 @@ interface SentrySpan : SentrySerializable [Export ("origin")] string Origin { get; set; } + // @required @property (copy, nonatomic) NSString * _Nullable spanDescription; + [Abstract] + [NullAllowed, Export ("spanDescription")] + string SpanDescription { get; set; } + // @required @property (nonatomic) SentrySpanStatus status; [Abstract] [Export ("status", ArgumentSemantic.Assign)] @@ -1600,6 +1609,11 @@ interface SentryOptions [Export ("enableMetricKit")] bool EnableMetricKit { get; set; } + // @property (assign, nonatomic) BOOL enableMetricKitRawPayload __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); + [NoWatch, NoTV, Introduced (PlatformName.MacCatalyst, 15, 0), Introduced (PlatformName.MacOSX, 12, 0), Introduced (PlatformName.iOS, 15, 0)] + [Export ("enableMetricKitRawPayload")] + bool EnableMetricKitRawPayload { get; set; } + // @property (nonatomic) BOOL enableTimeToFullDisplayTracing; [Export ("enableTimeToFullDisplayTracing")] bool EnableTimeToFullDisplayTracing { get; set; } @@ -2899,11 +2913,6 @@ interface PrivateSentrySDKOnly [Export ("options", ArgumentSemantic.Copy)] SentryOptions Options { get; } - // @property (assign, nonatomic, class) BOOL appStartMeasurementHybridSDKMode; - [Static] - [Export ("appStartMeasurementHybridSDKMode")] - bool AppStartMeasurementHybridSDKMode { get; set; } - // @property (assign, nonatomic, class) BOOL framesTrackingMeasurementHybridSDKMode; [Static] [Export ("framesTrackingMeasurementHybridSDKMode")] @@ -2979,11 +2988,6 @@ interface PrivateSentrySDKOnly [Export ("setReplayTags:")] void SetReplayTags (NSDictionary tags); - // +(NSDictionary * _Nullable)appStartMeasurementWithSpans; - [Static] - [NullAllowed, Export ("appStartMeasurementWithSpans")] - NSDictionary AppStartMeasurementWithSpans { get; } - // +(SentryUser * _Nonnull)userWithDictionary:(NSDictionary * _Nonnull)dictionary; [Static] [Export ("userWithDictionary:")] diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 53dfb78d00..1fd35c124c 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -12,28 +12,28 @@ var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() .Blacklist( - // NSObject - "IsEqual", - "CopyWithZone", - // PrivateSentrySDKOnly - "StoreEnvelope", - "CaptureEnvelope", - "EnvelopeWithData", - // SentryOptions - "CaptureUserFeedback" + // error CS0114: 'SentryXxx.IsEqual(NSObject?)' hides inherited member 'NSObject.IsEqual(NSObject?)'. + "Sentry*.IsEqual", + // error CS0246: The type or namespace name '_NSZone' could not be found + "Sentry*.CopyWithZone", + // SentryEnvelope* is blacklisted + "PrivateSentrySDKOnly.CaptureEnvelope", + "PrivateSentrySDKOnly.EnvelopeWithData", + "PrivateSentrySDKOnly.StoreEnvelope", + // deprecated + "Sentry*.CaptureUserFeedback" ) .Blacklist( + // deprecated "SentryUserFeedbackConfigurationBlock" ) .Blacklist( - "ConfigureUserFeedback", - "Description", - "EnableMetricKitRawPayload", - "AppStartMeasurement", - "AppStartMeasurementTimeoutInterval", - "OnAppStartMeasurementAvailable", - "SentryExperimentalOptions", - "SpanDescription" + // error CS0114: 'SentryXxx.Description' hides inherited member 'NSObject.Description'. + "Sentry*.Description", + // SentryAppStartMeasurement is not whitelisted + "PrivateSentrySDKOnly.*AppStartMeasurement*", + // deprecated + "SentryOptions.ConfigureUserFeedback" ) .Whitelist( "Constants", @@ -108,14 +108,60 @@ private static string GetIdentifier(SyntaxNode node) }; } + private static string GetQualifiedName(SyntaxNode node) + { + var identifier = GetIdentifier(node); + var parent = node.Parent; + while (parent != null) + { + if (parent is TypeDeclarationSyntax typeDecl) + { + return $"{typeDecl.Identifier.Text}.{identifier}"; + } + parent = parent.Parent; + } + return identifier; + } + + private static bool MatchesPattern(string name, string pattern) + { + if (pattern == name) + { + return true; + } + + if (!pattern.Contains('*') && !pattern.Contains('?')) + { + return false; + } + + var regexPattern = "^" + Regex.Escape(pattern) + .Replace("\\*", ".*") + .Replace("\\?", ".") + "$"; + return Regex.IsMatch(name, regexPattern); + } + + private static bool MatchesName(SyntaxNode node, string[] patterns) + { + var identifier = GetIdentifier(node); + var qualifiedName = GetQualifiedName(node); + foreach (var pattern in patterns) + { + if (MatchesPattern(identifier, pattern) || MatchesPattern(qualifiedName, pattern)) + { + return true; + } + } + return false; + } + public static CompilationUnitSyntax Blacklist( this CompilationUnitSyntax root, params string[] names) where T : SyntaxNode { - var nameSet = new HashSet(names); var nodesToRemove = root.DescendantNodes() .OfType() - .Where(node => nameSet.Contains(GetIdentifier(node))); + .Where(node => MatchesName(node, names)); return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; } @@ -123,10 +169,9 @@ public static CompilationUnitSyntax Whitelist( this CompilationUnitSyntax root, params string[] names) where T : SyntaxNode { - var nameSet = new HashSet(names); var nodesToRemove = root.DescendantNodes() .OfType() - .Where(node => !nameSet.Contains(GetIdentifier(node))); + .Where(node => !MatchesName(node, names)); return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; } } From d4be03c571bbb56e496269f81c954c4af615c868 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 14:12:18 +0100 Subject: [PATCH 04/36] Support negation --- tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 1fd35c124c..7eec5469b6 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -147,9 +147,10 @@ private static bool MatchesName(SyntaxNode node, string[] patterns) var qualifiedName = GetQualifiedName(node); foreach (var pattern in patterns) { - if (MatchesPattern(identifier, pattern) || MatchesPattern(qualifiedName, pattern)) + var actualPattern = pattern.TrimStart('!'); + if (MatchesPattern(identifier, actualPattern) || MatchesPattern(qualifiedName, actualPattern)) { - return true; + return !pattern.StartsWith('!'); } } return false; From f8cf3a86ac5ab8ef7ed216c8d82ba1974622ef2b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 15:41:08 +0100 Subject: [PATCH 05/36] Process attributes --- scripts/generate-cocoa-bindings.ps1 | 11 ----------- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 9 ++------- tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 11 +++++++++++ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index fc896d8685..e4519d53ad 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -243,12 +243,6 @@ $Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' # Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 $Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' -# Remove iOS attributes like [iOS (13, 0)] -$Text = $Text -replace '\[iOS \(13,\s?0\)\]\n?\s*', '' - -# Remove Unavailable attributes like [Unavailable (PlatformName.iOSAppExtension)] -$Text = $Text -replace '\[Unavailable \(PlatformName\.\w+\)\]\n?\s*', '' - # Fix delegate argument names $Text = $Text -replace '(NSError) arg\d', '$1 error' $Text = $Text -replace '(NSHttpUrlResponse) arg\d', '$1 response' @@ -307,11 +301,6 @@ $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' -# Replace obsolete platform availability attributes -$Text = $Text -replace '([\[,] )MacCatalyst \(', '$1Introduced (PlatformName.MacCatalyst, ' -$Text = $Text -replace '([\[,] )Mac \(', '$1Introduced (PlatformName.MacOSX, ' -$Text = $Text -replace '([\[,] )iOS \(', '$1Introduced (PlatformName.iOS, ' - # Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs $Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 8942f1fee8..30eb29e8c1 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -561,11 +561,8 @@ interface SentryException : SentrySerializable [Internal] interface SentryFeedbackAPI { - // -(void)showWidget __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); [Export ("showWidget")] void ShowWidget (); - - // -(void)hideWidget __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); [Export ("hideWidget")] void HideWidget (); } @@ -1605,12 +1602,12 @@ interface SentryOptions [Export ("failedRequestTargets", ArgumentSemantic.Strong)] NSObject[] FailedRequestTargets { get; set; } // @property (assign, nonatomic) BOOL enableMetricKit __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); - [NoWatch, NoTV, Introduced (PlatformName.MacCatalyst, 15, 0), Introduced (PlatformName.MacOSX, 12, 0), Introduced (PlatformName.iOS, 15, 0)] + [NoWatch, NoTV, MacCatalyst (15, 0)] [Export ("enableMetricKit")] bool EnableMetricKit { get; set; } // @property (assign, nonatomic) BOOL enableMetricKitRawPayload __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); - [NoWatch, NoTV, Introduced (PlatformName.MacCatalyst, 15, 0), Introduced (PlatformName.MacOSX, 12, 0), Introduced (PlatformName.iOS, 15, 0)] + [NoWatch, NoTV, MacCatalyst (15, 0)] [Export ("enableMetricKitRawPayload")] bool EnableMetricKitRawPayload { get; set; } @@ -2570,8 +2567,6 @@ interface SentrySDK [Static] [Export ("captureFeedback:")] void CaptureFeedback (SentryFeedback feedback); - - // @property (readonly, nonatomic, strong, class) SentryFeedbackAPI * _Nonnull feedback __attribute__((availability(ios, introduced=13.0))); [Static] [Export ("feedback", ArgumentSemantic.Strong)] SentryFeedbackAPI Feedback { get; } diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 7eec5469b6..48ed974274 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -11,6 +11,15 @@ var code = File.ReadAllText(args[0]); var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() + .Blacklist( + // error CS0246: The type or namespace name 'iOS' could not be found + "iOS", + // error CS0246: The type or namespace name 'Mac' could not be found + "Mac", + // error CS0117: 'PlatformName' does not contain a definition for 'iOSAppExtension' + "Unavailable" + ) + .Blacklist("") .Blacklist( // error CS0114: 'SentryXxx.IsEqual(NSObject?)' hides inherited member 'NSObject.IsEqual(NSObject?)'. "Sentry*.IsEqual", @@ -104,6 +113,8 @@ private static string GetIdentifier(SyntaxNode node) DelegateDeclarationSyntax del => del.Identifier.Text, MethodDeclarationSyntax method => method.Identifier.Text, PropertyDeclarationSyntax property => property.Identifier.Text, + AttributeSyntax attr => attr.Name.ToString(), + AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), _ => throw new NotSupportedException(node.GetType().Name) }; } From 21a86be4632b49d8f76365cf28e25fc6a313d36e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 15:43:32 +0100 Subject: [PATCH 06/36] Remove unneeded Constants --- scripts/generate-cocoa-bindings.ps1 | 20 ------------------- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 7 ------- .../Program.cs | 1 - 3 files changed, 28 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index e4519d53ad..ab77adf2d0 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -268,26 +268,6 @@ $Text = $Text -replace '(?ms)@protocol (SentryRedactOptions).+?\[Protocol \(Name # Adjust base types $Text = $Text -replace 'interface (SentrySpan|SentryRedactOptions)\b', "[BaseType (typeof(NSObject))]`n`$&" -# Fix string constants -$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|AppStartMeasurementWithSpans|BaggageHttpHeader) \{ get; \})', '$1' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 30eb29e8c1..7ccead1d16 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -391,13 +391,6 @@ interface SentryDsn NSUrl EnvelopeEndpoint { get; } } -partial interface Constants -{ - // extern NSString *const _Nonnull SentryErrorDomain __attribute__((visibility("default"))); - [Field ("SentryErrorDomain", "__Internal")] - NSString SentryErrorDomain { get; } -} - // @interface SentryEvent : NSObject [BaseType (typeof(NSObject))] [Internal] diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 48ed974274..3bb443e01e 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -45,7 +45,6 @@ "SentryOptions.ConfigureUserFeedback" ) .Whitelist( - "Constants", "ISentryRRWebEvent", "PrivateSentrySDKOnly", "SentryAttachment", From 15a8b02ac7a018dfc60169298d8ac2c2dcc2e319 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 15:58:04 +0100 Subject: [PATCH 07/36] SentryOnAppStartMeasurementAvailable --- scripts/generate-cocoa-bindings.ps1 | 1 - tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index ab77adf2d0..581d62f554 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -284,7 +284,6 @@ $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' # Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs $Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' -$Text = $Text -replace '.*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n', '' $Text = $Text -replace 'NSDictionary', 'NSDictionary' # Add header and output file diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 3bb443e01e..2e82f80440 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -25,7 +25,7 @@ "Sentry*.IsEqual", // error CS0246: The type or namespace name '_NSZone' could not be found "Sentry*.CopyWithZone", - // SentryEnvelope* is blacklisted + // SentryEnvelope* is not whitelisted "PrivateSentrySDKOnly.CaptureEnvelope", "PrivateSentrySDKOnly.EnvelopeWithData", "PrivateSentrySDKOnly.StoreEnvelope", @@ -33,6 +33,8 @@ "Sentry*.CaptureUserFeedback" ) .Blacklist( + // SentryAppStartMeasurement is not whitelisted + "SentryOnAppStartMeasurementAvailable", // deprecated "SentryUserFeedbackConfigurationBlock" ) From 830be9abf8bca7961d116267a72caf8472ca867b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 16:03:15 +0100 Subject: [PATCH 08/36] SentryStructuredLogAttribute --- scripts/generate-cocoa-bindings.ps1 | 2 -- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 4 ---- tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 2 ++ 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 581d62f554..0cb8422132 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -284,8 +284,6 @@ $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' # Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs $Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' -$Text = $Text -replace 'NSDictionary', 'NSDictionary' - # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 7ccead1d16..a305471a2c 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -2208,10 +2208,6 @@ interface SentryLog [Export ("body")] string Body { get; set; } - // @property (copy, nonatomic) NSDictionary * _Nonnull attributes; - [Export ("attributes", ArgumentSemantic.Copy)] - NSDictionary Attributes { get; set; } - // @property (nonatomic, strong) NSNumber * _Nullable severityNumber; [NullAllowed, Export ("severityNumber", ArgumentSemantic.Strong)] NSNumber SeverityNumber { get; set; } diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 2e82f80440..03ccbd51a5 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -43,6 +43,8 @@ "Sentry*.Description", // SentryAppStartMeasurement is not whitelisted "PrivateSentrySDKOnly.*AppStartMeasurement*", + // SentryStructuredLogAttribute is not whitelisted + "SentryLog.Attributes", // deprecated "SentryOptions.ConfigureUserFeedback" ) From f69b682f4bc705480b0c467f31c92e3ad7183e8a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 29 Oct 2025 16:46:13 +0100 Subject: [PATCH 09/36] ref: SyntaxNode/StringExtensions --- .../Program.cs | 101 ++++++++++-------- 1 file changed, 59 insertions(+), 42 deletions(-) diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 03ccbd51a5..6a0894a5bb 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -108,7 +108,30 @@ internal static class FilterExtensions { - private static string GetIdentifier(SyntaxNode node) + public static CompilationUnitSyntax Blacklist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => names.Any(node.Matches)); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } + + public static CompilationUnitSyntax Whitelist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => !names.Any(node.Matches)); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } +} + +internal static class SyntaxNodeExtensions +{ + public static string GetIdentifier(this SyntaxNode node) { return node switch { @@ -122,9 +145,25 @@ private static string GetIdentifier(SyntaxNode node) }; } - private static string GetQualifiedName(SyntaxNode node) + public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) { - var identifier = GetIdentifier(node); + var identifier = SyntaxFactory.Identifier(newName); + return node switch + { + InterfaceDeclarationSyntax iface => iface.WithIdentifier(identifier), + ClassDeclarationSyntax cls => cls.WithIdentifier(identifier), + StructDeclarationSyntax str => str.WithIdentifier(identifier), + EnumDeclarationSyntax enm => enm.WithIdentifier(identifier), + DelegateDeclarationSyntax del => del.WithIdentifier(identifier), + MethodDeclarationSyntax method => method.WithIdentifier(identifier), + PropertyDeclarationSyntax property => property.WithIdentifier(identifier), + _ => throw new NotSupportedException(node.GetType().Name) + }; + } + + public static string GetQualifiedName(this SyntaxNode node) + { + var identifier = node.GetIdentifier(); var parent = node.Parent; while (parent != null) { @@ -137,9 +176,22 @@ private static string GetQualifiedName(SyntaxNode node) return identifier; } - private static bool MatchesPattern(string name, string pattern) + public static bool Matches(this SyntaxNode node, string pattern) { - if (pattern == name) + var actualPattern = pattern.TrimStart('!'); + if (node.GetIdentifier().Matches(actualPattern) || node.GetQualifiedName().Matches(actualPattern)) + { + return !pattern.StartsWith('!'); + } + return false; + } +} + +internal static class StringExtensions +{ + public static bool Matches(this string str, string pattern) + { + if (pattern == str) { return true; } @@ -149,44 +201,9 @@ private static bool MatchesPattern(string name, string pattern) return false; } - var regexPattern = "^" + Regex.Escape(pattern) + var regex = "^" + Regex.Escape(pattern) .Replace("\\*", ".*") .Replace("\\?", ".") + "$"; - return Regex.IsMatch(name, regexPattern); - } - - private static bool MatchesName(SyntaxNode node, string[] patterns) - { - var identifier = GetIdentifier(node); - var qualifiedName = GetQualifiedName(node); - foreach (var pattern in patterns) - { - var actualPattern = pattern.TrimStart('!'); - if (MatchesPattern(identifier, actualPattern) || MatchesPattern(qualifiedName, actualPattern)) - { - return !pattern.StartsWith('!'); - } - } - return false; - } - - public static CompilationUnitSyntax Blacklist( - this CompilationUnitSyntax root, - params string[] names) where T : SyntaxNode - { - var nodesToRemove = root.DescendantNodes() - .OfType() - .Where(node => MatchesName(node, names)); - return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; - } - - public static CompilationUnitSyntax Whitelist( - this CompilationUnitSyntax root, - params string[] names) where T : SyntaxNode - { - var nodesToRemove = root.DescendantNodes() - .OfType() - .Where(node => !MatchesName(node, names)); - return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + return Regex.IsMatch(str, regex); } } From 74610f828da58f405ec8b13eaa8b706e6b46fb10 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 09:15:55 +0100 Subject: [PATCH 10/36] Insert namespace --- scripts/generate-cocoa-bindings.ps1 | 3 --- .../Program.cs | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 0cb8422132..86f04f48da 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -230,9 +230,6 @@ $Text = $Text -replace '\t', ' ' # Trim extra newline at EOF $Text = $Text -replace '\n$', '' -# Insert namespace -$Text = $Text -replace 'using .+;\n\n', "$&namespace Sentry.CocoaSdk;`n`n" - # Set Internal attributes on interfaces and delegates $Text = $Text -replace '(?m)^(partial interface|interface|delegate)\b', "[Internal]`n$&" diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 6a0894a5bb..07f1b8f891 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -11,6 +11,7 @@ var code = File.ReadAllText(args[0]); var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() + .InsertNamespace("Sentry.CocoaSdk") .Blacklist( // error CS0246: The type or namespace name 'iOS' could not be found "iOS", @@ -127,6 +128,20 @@ public static CompilationUnitSyntax Whitelist( .Where(node => !names.Any(node.Matches)); return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; } + + public static CompilationUnitSyntax InsertNamespace( + this CompilationUnitSyntax root, + string name) + { + var namespaceDeclaration = SyntaxFactory.FileScopedNamespaceDeclaration(SyntaxFactory.ParseName(name)) + .WithNamespaceKeyword(SyntaxFactory.Token(SyntaxKind.NamespaceKeyword) + .WithLeadingTrivia(SyntaxFactory.EndOfLine("\n")) + .WithTrailingTrivia(SyntaxFactory.Space)) + .WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); + return SyntaxFactory.CompilationUnit() + .WithUsings(root.Usings) + .AddMembers(namespaceDeclaration.WithMembers(root.Members)); + } } internal static class SyntaxNodeExtensions From 79a385b9d20640ced0fd1217372e7121edb90df7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 09:29:11 +0100 Subject: [PATCH 11/36] Rename SentryRRWebEvent --- scripts/generate-cocoa-bindings.ps1 | 3 -- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 2 +- .../Program.cs | 45 +++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 86f04f48da..744a56b01e 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -254,9 +254,6 @@ $Text = $Text -replace '(SentryProfileOptions) arg\d', '$1 options' # Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) $Text = $Text -replace 'delegate \w+ Sentry(BeforeBreadcrumb|BeforeSendEvent|TracesSampler)Callback', "[return: NullAllowed]`n$&" -# Rename SentryRRWebEvent protocol -$Text = $Text -replace 'interface (SentryRRWebEvent) : SentrySerializable', 'interface I$1 : SentrySerializable' - # Adjust protocols (some are models) $Text = $Text -replace '(?ms)(@protocol.+?)/\*.+?\*/', '$1' $Text = $Text -replace '(?ms)@protocol (SentrySerializable|SentrySpan).+?\[Protocol\]', "`$&`n[Model]" diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index a305471a2c..6f2ed9c01b 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -2289,7 +2289,7 @@ interface SentryProfileOptions // @protocol SentryRRWebEvent [Protocol] [Internal] -interface ISentryRRWebEvent : SentrySerializable +interface ISentryRRWebEvent: SentrySerializable { } diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 07f1b8f891..8a85fce7c8 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -12,6 +12,8 @@ var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() .InsertNamespace("Sentry.CocoaSdk") + // rename conflicting SentryRRWebEvent (protocol vs. interface) + .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) .Blacklist( // error CS0246: The type or namespace name 'iOS' could not be found "iOS", @@ -142,6 +144,23 @@ public static CompilationUnitSyntax InsertNamespace( .WithUsings(root.Usings) .AddMembers(namespaceDeclaration.WithMembers(root.Members)); } + + public static CompilationUnitSyntax Rename( + this CompilationUnitSyntax root, + string oldName, + string newName, + Func? predicate = null) where T : SyntaxNode + { + var replacements = new Dictionary(); + foreach (var node in root.DescendantNodes().OfType()) + { + if (node.GetIdentifier() == oldName && (predicate == null || predicate(node))) + { + replacements[node] = node.WithIdentifier(newName); + } + } + return root.ReplaceNodes(replacements.Keys, (orig, _) => replacements[orig]); + } } internal static class SyntaxNodeExtensions @@ -200,6 +219,32 @@ public static bool Matches(this SyntaxNode node, string pattern) } return false; } + + public static bool HasAttribute(this SyntaxNode node, string attributeName) + { + return node switch + { + InterfaceDeclarationSyntax iface => iface.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + ClassDeclarationSyntax cls => cls.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + StructDeclarationSyntax str => str.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + EnumDeclarationSyntax enm => enm.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + MethodDeclarationSyntax method => method.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + PropertyDeclarationSyntax property => property.AttributeLists + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.ToString() == attributeName), + _ => false + }; + } } internal static class StringExtensions From 6cc4c847859744e79670b828264bec7ea4e62cc1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 11:11:41 +0100 Subject: [PATCH 12/36] Models --- scripts/generate-cocoa-bindings.ps1 | 14 -- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 23 +--- .../Program.cs | 127 +++++++++++++++++- 3 files changed, 126 insertions(+), 38 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 744a56b01e..bbf731b1ed 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -230,9 +230,6 @@ $Text = $Text -replace '\t', ' ' # Trim extra newline at EOF $Text = $Text -replace '\n$', '' -# Set Internal attributes on interfaces and delegates -$Text = $Text -replace '(?m)^(partial interface|interface|delegate)\b', "[Internal]`n$&" - # Fix interface usage $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' $Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' @@ -251,17 +248,6 @@ $Text = $Text -replace '(SentryAppStartMeasurement) arg\d', '$1 appStartMeasurem $Text = $Text -replace '(SentryLog) arg\d', '$1 log' $Text = $Text -replace '(SentryProfileOptions) arg\d', '$1 options' -# Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) -$Text = $Text -replace 'delegate \w+ Sentry(BeforeBreadcrumb|BeforeSendEvent|TracesSampler)Callback', "[return: NullAllowed]`n$&" - -# Adjust protocols (some are models) -$Text = $Text -replace '(?ms)(@protocol.+?)/\*.+?\*/', '$1' -$Text = $Text -replace '(?ms)@protocol (SentrySerializable|SentrySpan).+?\[Protocol\]', "`$&`n[Model]" -$Text = $Text -replace '(?ms)@protocol (SentryRedactOptions).+?\[Protocol \(Name = \"\w+\"\)\]', "`$&`n[Model]" - -# Adjust base types -$Text = $Text -replace 'interface (SentrySpan|SentryRedactOptions)\b', "[BaseType (typeof(NSObject))]`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|AppStartMeasurementWithSpans|BaggageHttpHeader) \{ get; \})', '$1' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 6f2ed9c01b..3550b4f931 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -172,10 +172,10 @@ interface SentryBaggage // @protocol SentrySerializable [Protocol] -[Model] [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] +[Model] interface SentrySerializable { // @required -(NSDictionary * _Nonnull)serialize; @@ -736,8 +736,8 @@ interface SentrySpanContext : SentrySerializable // @protocol SentrySpan [Protocol] -[Model] [Internal] +[Model] [BaseType (typeof(NSObject))] interface SentrySpan : SentrySerializable { @@ -1009,23 +1009,6 @@ interface SentryHub void Close (); } -// @protocol SentryIntegrationProtocol -[Protocol] -[BaseType (typeof(NSObject))] -[Internal] -interface SentryIntegrationProtocol -{ - // @required -(BOOL)installWithOptions:(SentryOptions * _Nonnull)options __attribute__((swift_name("install(with:)"))); - [Abstract] - [Export ("installWithOptions:")] - bool InstallWithOptions (SentryOptions options); - - // @required -(void)uninstall; - [Abstract] - [Export ("uninstall")] - void Uninstall (); -} - // @interface SentryMeasurementUnit : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -2310,8 +2293,8 @@ interface SentryRRWebEvent : ISentryRRWebEvent // @protocol SentryRedactOptions [Protocol (Name = "_TtP6Sentry19SentryRedactOptions_")] -[Model] [Internal] +[Model] [BaseType (typeof(NSObject))] interface SentryRedactOptions { diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 8a85fce7c8..8f95e32023 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -11,9 +11,24 @@ var code = File.ReadAllText(args[0]); var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() - .InsertNamespace("Sentry.CocoaSdk") - // rename conflicting SentryRRWebEvent (protocol vs. interface) + .Namespace("Sentry.CocoaSdk") + // Set Internal attributes on all interfaces and delegates + .Attribute("Internal") + .Attribute("Internal") + // Adjust protocols (some are models) + .Model("SentryRedactOptions") + .Model("SentrySerializable") + .Model("SentrySpan") + .Model("SentryRRWebEvent", false) + .Model("SentryReplayBreadcrumbConverter", false) + .Model("SentryViewScreenshotProvider", false) + // Adjust base types + .BaseType("SentrySpan", "NSObject") + .BaseType("SentryRedactOptions", "NSObject") + // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) + // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) + .Attribute("return: NullAllowed", del => del.GetIdentifier() is "SentryBeforeBreadcrumbCallback" or "SentryBeforeSendEventCallback" or "SentryTracesSamplerCallback") .Blacklist( // error CS0246: The type or namespace name 'iOS' could not be found "iOS", @@ -70,7 +85,6 @@ "SentryHttpStatusCodeRange", "SentryHub", "SentryId", - "SentryIntegrationProtocol", "SentryLog", "SentryLogger", "SentryMeasurementUnit", @@ -131,7 +145,7 @@ public static CompilationUnitSyntax Whitelist( return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; } - public static CompilationUnitSyntax InsertNamespace( + public static CompilationUnitSyntax Namespace( this CompilationUnitSyntax root, string name) { @@ -145,6 +159,60 @@ public static CompilationUnitSyntax InsertNamespace( .AddMembers(namespaceDeclaration.WithMembers(root.Members)); } + public static CompilationUnitSyntax Attribute( + this CompilationUnitSyntax root, + string name, + Func? predicate = null) where T : SyntaxNode + { + var nodesToUpdate = root.DescendantNodes() + .OfType() + .Where(node => predicate == null || predicate(node)) + .Where(node => !node.HasAttribute(name)) + .ToList(); + + var attribute = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(name)); + var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(attribute)); + + var replacements = nodesToUpdate.ToDictionary( + node => node, + node => node.WithAttribute(attributeList)); + + return root.ReplaceNodes(replacements.Keys, (orig, _) => replacements[orig]); + } + + public static CompilationUnitSyntax Model( + this CompilationUnitSyntax root, + string name, + bool isModel = true) + { + var iface = root.DescendantNodes() + .OfType() + .Where(i => i.GetIdentifier() == name) + .Where(i => i.HasAttribute("Protocol")) + .FirstOrDefault(); + + if (iface == null) + { + return root; + } + + var trivia = SyntaxFactory.TriviaList( + iface.GetLeadingTrivia().Where(t => + !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains("[Model]")))); + var result = root.ReplaceNode(iface, iface.WithLeadingTrivia(trivia)); + return isModel + ? result.Attribute("Model", i => i.GetIdentifier() == name) + : result; + } + + public static CompilationUnitSyntax BaseType( + this CompilationUnitSyntax root, + string name, + string baseType) + { + return root.Attribute($"BaseType (typeof({baseType}))", iface => iface.Matches(name)); + } + public static CompilationUnitSyntax Rename( this CompilationUnitSyntax root, string oldName, @@ -195,6 +263,57 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) }; } + public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax attributeList) + { + var existingAttributes = node switch + { + InterfaceDeclarationSyntax iface => iface.AttributeLists, + ClassDeclarationSyntax cls => cls.AttributeLists, + StructDeclarationSyntax str => str.AttributeLists, + EnumDeclarationSyntax enm => enm.AttributeLists, + DelegateDeclarationSyntax del => del.AttributeLists, + MethodDeclarationSyntax method => method.AttributeLists, + PropertyDeclarationSyntax property => property.AttributeLists, + _ => throw new NotSupportedException(node.GetType().Name) + }; + + if (existingAttributes.Count > 0) + { + var listWithTrivia = attributeList.WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); + return node switch + { + InterfaceDeclarationSyntax iface => iface.AddAttributeLists(listWithTrivia), + ClassDeclarationSyntax cls => cls.AddAttributeLists(listWithTrivia), + StructDeclarationSyntax str => str.AddAttributeLists(listWithTrivia), + EnumDeclarationSyntax enm => enm.AddAttributeLists(listWithTrivia), + DelegateDeclarationSyntax del => del.AddAttributeLists(listWithTrivia), + MethodDeclarationSyntax method => method.AddAttributeLists(listWithTrivia), + PropertyDeclarationSyntax property => property.AddAttributeLists(listWithTrivia), + _ => throw new NotSupportedException(node.GetType().Name) + }; + } + else + { + var listWithTrivia = attributeList + .WithLeadingTrivia(node.GetLeadingTrivia()) + .WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); + + var nodeWithoutLeadingTrivia = node.WithLeadingTrivia(SyntaxFactory.TriviaList()); + + return nodeWithoutLeadingTrivia switch + { + InterfaceDeclarationSyntax iface => iface.AddAttributeLists(listWithTrivia), + ClassDeclarationSyntax cls => cls.AddAttributeLists(listWithTrivia), + StructDeclarationSyntax str => str.AddAttributeLists(listWithTrivia), + EnumDeclarationSyntax enm => enm.AddAttributeLists(listWithTrivia), + DelegateDeclarationSyntax del => del.AddAttributeLists(listWithTrivia), + MethodDeclarationSyntax method => method.AddAttributeLists(listWithTrivia), + PropertyDeclarationSyntax property => property.AddAttributeLists(listWithTrivia), + _ => throw new NotSupportedException(node.GetType().Name) + }; + } + } + public static string GetQualifiedName(this SyntaxNode node) { var identifier = node.GetIdentifier(); From 8a4057ebe80da9d86ea9af39133636deb213b495 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 11:40:02 +0100 Subject: [PATCH 13/36] INSCopying --- scripts/generate-cocoa-bindings.ps1 | 3 --- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 18 ++++++------------ .../Program.cs | 5 +++++ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index bbf731b1ed..5977767c67 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -234,9 +234,6 @@ $Text = $Text -replace '\n$', '' $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' $Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' -# Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 -$Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' - # Fix delegate argument names $Text = $Text -replace '(NSError) arg\d', '$1 error' $Text = $Text -replace '(NSHttpUrlResponse) arg\d', '$1 response' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 3550b4f931..b274df9139 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -637,8 +637,7 @@ interface SentryFrame : SentrySerializable // @interface SentryGeo : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryGeo : SentrySerializable -{ +interface SentryGeo : SentrySerializable{ // @property (copy, atomic) NSString * _Nullable city; [NullAllowed, Export ("city")] string City { get; set; } @@ -1013,8 +1012,7 @@ interface SentryHub [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMeasurementUnit -{ +interface SentryMeasurementUnit { // -(instancetype _Nonnull)initWithUnit:(NSString * _Nonnull)unit; [Export ("initWithUnit:")] NativeHandle Constructor (string unit); @@ -1832,8 +1830,7 @@ partial interface SentryScope : SentrySerializable // @interface SentrySpanId : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentrySpanId -{ +interface SentrySpanId { // -(instancetype _Nonnull)initWithUUID:(NSUUID * _Nonnull)uuid; [Export ("initWithUUID:")] NativeHandle Constructor (NSUuid uuid); @@ -2077,8 +2074,7 @@ interface SentryTransactionContext // @interface SentryUser : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryUser : SentrySerializable -{ +interface SentryUser : SentrySerializable{ // @property (copy, atomic) NSString * _Nullable userId; [NullAllowed, Export ("userId")] string UserId { get; set; } @@ -2628,8 +2624,7 @@ interface SentrySDK [BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] [DisableDefaultCtor] [Internal] -interface SentrySession -{ +interface SentrySession { // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); [Export ("initWithReleaseName:distinctId:")] [DesignatedInitializer] @@ -2768,8 +2763,7 @@ interface SentryViewScreenshotOptions : SentryRedactOptions [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryScreenFrames -{ +interface SentryScreenFrames { // -(instancetype _Nonnull)initWithTotal:(NSUInteger)total frozen:(NSUInteger)frozen slow:(NSUInteger)slow; [Export ("initWithTotal:frozen:slow:")] NativeHandle Constructor (nuint total, nuint frozen, nuint slow); diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 8f95e32023..583f294f05 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -25,6 +25,9 @@ // Adjust base types .BaseType("SentrySpan", "NSObject") .BaseType("SentryRedactOptions", "NSObject") + // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 + .Blacklist("INSCopying") + .Blacklist("") // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) @@ -243,6 +246,8 @@ public static string GetIdentifier(this SyntaxNode node) PropertyDeclarationSyntax property => property.Identifier.Text, AttributeSyntax attr => attr.Name.ToString(), AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), + BaseTypeSyntax type => type.Type.ToString(), + BaseListSyntax list => string.Join(",", list.Types.Select(t => t.Type.ToString())), _ => throw new NotSupportedException(node.GetType().Name) }; } From bb48bead756d4a92e1eb091874a1e2fc60b1e4fe Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 12:18:46 +0100 Subject: [PATCH 14/36] tabs to spaces --- scripts/generate-cocoa-bindings.ps1 | 6 ------ tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 8 +++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 5977767c67..18b32a4a2b 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,12 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Tabs to spaces -$Text = $Text -replace '\t', ' ' - -# Trim extra newline at EOF -$Text = $Text -replace '\n$', '' - # Fix interface usage $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' $Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 583f294f05..f5835872ad 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -124,7 +124,8 @@ "SentryViewScreenshotOptions", "SentryViewScreenshotProvider" ); -File.WriteAllText(args[0], nodes.ToFullString()); + +File.WriteAllText(args[0], nodes.ToFullString().TabsToSpaces()); internal static class FilterExtensions { @@ -390,4 +391,9 @@ public static bool Matches(this string str, string pattern) .Replace("\\?", ".") + "$"; return Regex.IsMatch(str, regex); } + + public static string TabsToSpaces(this string str, int spacesPerTab = 4) + { + return str.Replace("\t", new string(' ', spacesPerTab)); + } } From 0bdee4351408880b657b70ace839999820071442 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 12:26:29 +0100 Subject: [PATCH 15/36] Interfaces --- scripts/generate-cocoa-bindings.ps1 | 4 -- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 46 +++++++++---------- .../Program.cs | 30 ++++++++---- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 18b32a4a2b..8156eeff40 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,10 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Fix interface usage -$Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' -$Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' - # Fix delegate argument names $Text = $Text -replace '(NSError) arg\d', '$1 error' $Text = $Text -replace '(NSHttpUrlResponse) arg\d', '$1 response' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index b274df9139..b5e7df75bf 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -176,7 +176,7 @@ interface SentryBaggage [DisableDefaultCtor] [Internal] [Model] -interface SentrySerializable +interface ISentrySerializable { // @required -(NSDictionary * _Nonnull)serialize; [Abstract] @@ -187,7 +187,7 @@ interface SentrySerializable // @interface SentryBreadcrumb : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryBreadcrumb : SentrySerializable +interface SentryBreadcrumb : ISentrySerializable { // @property (nonatomic) SentryLevel level; [Export ("level", ArgumentSemantic.Assign)] @@ -330,7 +330,7 @@ interface SentryDebugImageProvider // @interface SentryDebugMeta : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryDebugMeta : SentrySerializable +interface SentryDebugMeta : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nullable uuid; [NullAllowed, Export ("uuid")] @@ -394,7 +394,7 @@ interface SentryDsn // @interface SentryEvent : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryEvent : SentrySerializable +interface SentryEvent : ISentrySerializable { // @property (nonatomic, strong) SentryId * _Nonnull eventId; [Export ("eventId", ArgumentSemantic.Strong)] @@ -518,7 +518,7 @@ interface SentryEvent : SentrySerializable [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryException : SentrySerializable +interface SentryException : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull value; [Export ("value")] @@ -563,7 +563,7 @@ interface SentryFeedbackAPI // @interface SentryFrame : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryFrame : SentrySerializable +interface SentryFrame : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nullable symbolAddress; [NullAllowed, Export ("symbolAddress")] @@ -637,7 +637,7 @@ interface SentryFrame : SentrySerializable // @interface SentryGeo : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryGeo : SentrySerializable{ +interface SentryGeo : ISentrySerializable{ // @property (copy, atomic) NSString * _Nullable city; [NullAllowed, Export ("city")] string City { get; set; } @@ -686,7 +686,7 @@ interface SentryHttpStatusCodeRange [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentrySpanContext : SentrySerializable +interface SentrySpanContext : ISentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; [Export ("traceId")] @@ -738,7 +738,7 @@ interface SentrySpanContext : SentrySerializable [Internal] [Model] [BaseType (typeof(NSObject))] -interface SentrySpan : SentrySerializable +interface SentrySpan : ISentrySerializable { // @required @property (nonatomic, strong) SentryId * _Nonnull traceId; [Abstract] @@ -1172,7 +1172,7 @@ interface SentryMeasurementUnitFraction [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMechanism : SentrySerializable +interface SentryMechanism : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull type; [Export ("type")] @@ -1210,7 +1210,7 @@ interface SentryMechanism : SentrySerializable // @interface SentryMechanismMeta : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryMechanismMeta : SentrySerializable +interface SentryMechanismMeta : ISentrySerializable { // @property (nonatomic, strong) NSDictionary * _Nullable signal; [NullAllowed, Export ("signal", ArgumentSemantic.Strong)] @@ -1229,7 +1229,7 @@ interface SentryMechanismMeta : SentrySerializable [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMessage : SentrySerializable +interface SentryMessage : ISentrySerializable { // -(instancetype _Nonnull)initWithFormatted:(NSString * _Nonnull)formatted; [Export ("initWithFormatted:")] @@ -1252,7 +1252,7 @@ interface SentryMessage : SentrySerializable [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryNSError : SentrySerializable +interface SentryNSError : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull domain; [Export ("domain")] @@ -1659,7 +1659,7 @@ interface SentryReplayApi // @interface SentryRequest : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryRequest : SentrySerializable +interface SentryRequest : ISentrySerializable { // @property (copy, nonatomic) NSNumber * _Nullable bodySize; [NullAllowed, Export ("bodySize", ArgumentSemantic.Copy)] @@ -1715,7 +1715,7 @@ interface SentrySamplingContext // @interface SentryScope : NSObject [BaseType (typeof(NSObject))] [Internal] -partial interface SentryScope : SentrySerializable +partial interface SentryScope : ISentrySerializable { // @property (nonatomic, strong) id _Nullable span; [NullAllowed, Export ("span", ArgumentSemantic.Strong)] @@ -1853,7 +1853,7 @@ interface SentrySpanId { [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryStacktrace : SentrySerializable +interface SentryStacktrace : ISentrySerializable { // @property (nonatomic, strong) NSArray * _Nonnull frames; [Export ("frames", ArgumentSemantic.Strong)] @@ -1880,7 +1880,7 @@ interface SentryStacktrace : SentrySerializable [BaseType (typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryThread : SentrySerializable +interface SentryThread : ISentrySerializable { // @property (copy, nonatomic) NSNumber * _Nonnull threadId; [Export ("threadId", ArgumentSemantic.Copy)] @@ -1914,7 +1914,7 @@ interface SentryThread : SentrySerializable // @interface SentryTraceContext : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryTraceContext : SentrySerializable +interface SentryTraceContext : ISentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; [Export ("traceId")] @@ -2074,7 +2074,7 @@ interface SentryTransactionContext // @interface SentryUser : NSObject [BaseType (typeof(NSObject))] [Internal] -interface SentryUser : SentrySerializable{ +interface SentryUser : ISentrySerializable{ // @property (copy, atomic) NSString * _Nullable userId; [NullAllowed, Export ("userId")] string UserId { get; set; } @@ -2268,7 +2268,7 @@ interface SentryProfileOptions // @protocol SentryRRWebEvent [Protocol] [Internal] -interface ISentryRRWebEvent: SentrySerializable +interface ISentryRRWebEvent : ISentrySerializable { } @@ -2292,7 +2292,7 @@ interface SentryRRWebEvent : ISentryRRWebEvent [Internal] [Model] [BaseType (typeof(NSObject))] -interface SentryRedactOptions +interface ISentryRedactOptions { // @required @property (readonly, nonatomic) BOOL maskAllText; [Abstract] @@ -2331,7 +2331,7 @@ interface SentryReplayBreadcrumbConverter // @interface SentryReplayOptions : NSObject [BaseType (typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] [Internal] -interface SentryReplayOptions : SentryRedactOptions +interface SentryReplayOptions : ISentryRedactOptions { // @property (nonatomic) float sessionSampleRate; [Export ("sessionSampleRate")] @@ -2727,7 +2727,7 @@ interface SentryViewScreenshotProvider // @interface SentryViewScreenshotOptions : NSObject [BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] [Internal] -interface SentryViewScreenshotOptions : SentryRedactOptions +interface SentryViewScreenshotOptions : ISentryRedactOptions { // @property (nonatomic) BOOL enableViewRendererV2; [Export ("enableViewRendererV2")] diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index f5835872ad..8ac2b394c7 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -28,6 +28,9 @@ // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 .Blacklist("INSCopying") .Blacklist("") + // Fix interface names + .Rename("SentrySerializable", "ISentrySerializable") + .Rename("SentryRedactOptions", "ISentryRedactOptions") // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) @@ -70,7 +73,9 @@ "SentryOptions.ConfigureUserFeedback" ) .Whitelist( + "ISentryRedactOptions", "ISentryRRWebEvent", + "ISentrySerializable", "PrivateSentrySDKOnly", "SentryAttachment", "SentryBaggage", @@ -110,7 +115,6 @@ "SentryScope", "SentryScreenFrames", "SentrySDK", - "SentrySerializable", "SentrySession", "SentrySpan", "SentrySpanContext", @@ -255,16 +259,24 @@ public static string GetIdentifier(this SyntaxNode node) public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) { - var identifier = SyntaxFactory.Identifier(newName); + var oldIdentifier = node switch + { + TypeDeclarationSyntax type => type.Identifier, + DelegateDeclarationSyntax del => del.Identifier, + MethodDeclarationSyntax method => method.Identifier, + PropertyDeclarationSyntax property => property.Identifier, + _ => throw new NotSupportedException(node.GetType().Name) + }; + var newIdentifier = SyntaxFactory.Identifier(newName).WithTrailingTrivia(oldIdentifier.TrailingTrivia); return node switch { - InterfaceDeclarationSyntax iface => iface.WithIdentifier(identifier), - ClassDeclarationSyntax cls => cls.WithIdentifier(identifier), - StructDeclarationSyntax str => str.WithIdentifier(identifier), - EnumDeclarationSyntax enm => enm.WithIdentifier(identifier), - DelegateDeclarationSyntax del => del.WithIdentifier(identifier), - MethodDeclarationSyntax method => method.WithIdentifier(identifier), - PropertyDeclarationSyntax property => property.WithIdentifier(identifier), + InterfaceDeclarationSyntax iface => iface.WithIdentifier(newIdentifier), + ClassDeclarationSyntax cls => cls.WithIdentifier(newIdentifier), + StructDeclarationSyntax str => str.WithIdentifier(newIdentifier), + EnumDeclarationSyntax enm => enm.WithIdentifier(newIdentifier), + DelegateDeclarationSyntax del => del.WithIdentifier(newIdentifier), + MethodDeclarationSyntax method => method.WithIdentifier(newIdentifier), + PropertyDeclarationSyntax property => property.WithIdentifier(newIdentifier), _ => throw new NotSupportedException(node.GetType().Name) }; } From f6d91192c896170ffde8846d14f7daacfb903ee1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 12:40:23 +0100 Subject: [PATCH 16/36] Argument names --- scripts/generate-cocoa-bindings.ps1 | 11 ----------- .../Program.cs | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 8156eeff40..87661e0c81 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,17 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Fix delegate argument names -$Text = $Text -replace '(NSError) arg\d', '$1 error' -$Text = $Text -replace '(NSHttpUrlResponse) arg\d', '$1 response' -$Text = $Text -replace '(SentryEvent) arg\d', '$1 @event' -$Text = $Text -replace '(SentrySamplingContext) arg\d', '$1 samplingContext' -$Text = $Text -replace '(SentryBreadcrumb) arg\d', '$1 breadcrumb' -$Text = $Text -replace '(SentrySpan) arg\d', '$1 span' -$Text = $Text -replace '(SentryAppStartMeasurement) arg\d', '$1 appStartMeasurement' -$Text = $Text -replace '(SentryLog) arg\d', '$1 log' -$Text = $Text -replace '(SentryProfileOptions) arg\d', '$1 options' - # 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|AppStartMeasurementWithSpans|BaggageHttpHeader) \{ get; \})', '$1' diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 8ac2b394c7..77fc50714c 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -28,6 +28,15 @@ // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 .Blacklist("INSCopying") .Blacklist("") + // Fix delegate argument names + .Rename("arg*", "error", p => p.Type?.ToString() == "NSError") + .Rename("arg*", "response", p => p.Type?.ToString() == "NSHttpUrlResponse") + .Rename("arg*", "@event", p => p.Type?.ToString() == "SentryEvent") + .Rename("arg*", "samplingContext", p => p.Type?.ToString() == "SentrySamplingContext") + .Rename("arg*", "breadcrumb", p => p.Type?.ToString() == "SentryBreadcrumb") + .Rename("arg*", "span", p => p.Type?.ToString() == "SentrySpan") + .Rename("arg*", "log", p => p.Type?.ToString() == "SentryLog") + .Rename("arg*", "options", p => p.Type?.ToString() == "SentryProfileOptions") // Fix interface names .Rename("SentrySerializable", "ISentrySerializable") .Rename("SentryRedactOptions", "ISentryRedactOptions") @@ -195,7 +204,7 @@ public static CompilationUnitSyntax Model( { var iface = root.DescendantNodes() .OfType() - .Where(i => i.GetIdentifier() == name) + .Where(i => i.Matches(name)) .Where(i => i.HasAttribute("Protocol")) .FirstOrDefault(); @@ -209,7 +218,7 @@ public static CompilationUnitSyntax Model( !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains("[Model]")))); var result = root.ReplaceNode(iface, iface.WithLeadingTrivia(trivia)); return isModel - ? result.Attribute("Model", i => i.GetIdentifier() == name) + ? result.Attribute("Model", i => i.Matches(name)) : result; } @@ -230,7 +239,7 @@ public static CompilationUnitSyntax Rename( var replacements = new Dictionary(); foreach (var node in root.DescendantNodes().OfType()) { - if (node.GetIdentifier() == oldName && (predicate == null || predicate(node))) + if (node.Matches(oldName) && (predicate == null || predicate(node))) { replacements[node] = node.WithIdentifier(newName); } @@ -249,6 +258,7 @@ public static string GetIdentifier(this SyntaxNode node) DelegateDeclarationSyntax del => del.Identifier.Text, MethodDeclarationSyntax method => method.Identifier.Text, PropertyDeclarationSyntax property => property.Identifier.Text, + ParameterSyntax param => param.Identifier.Text, AttributeSyntax attr => attr.Name.ToString(), AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), BaseTypeSyntax type => type.Type.ToString(), @@ -265,6 +275,7 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) DelegateDeclarationSyntax del => del.Identifier, MethodDeclarationSyntax method => method.Identifier, PropertyDeclarationSyntax property => property.Identifier, + ParameterSyntax param => param.Identifier, _ => throw new NotSupportedException(node.GetType().Name) }; var newIdentifier = SyntaxFactory.Identifier(newName).WithTrailingTrivia(oldIdentifier.TrailingTrivia); @@ -277,6 +288,7 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) DelegateDeclarationSyntax del => del.WithIdentifier(newIdentifier), MethodDeclarationSyntax method => method.WithIdentifier(newIdentifier), PropertyDeclarationSyntax property => property.WithIdentifier(newIdentifier), + ParameterSyntax param => param.WithIdentifier(newIdentifier), _ => throw new NotSupportedException(node.GetType().Name) }; } From db67798198ed6d3f32602e545346ef40e15fe9a6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 12:49:23 +0100 Subject: [PATCH 17/36] partial SentryScope --- scripts/generate-cocoa-bindings.ps1 | 3 --- .../Program.cs | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 87661e0c81..9bf4652935 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -237,9 +237,6 @@ $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' -# Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs -$Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' - # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 77fc50714c..db8732618a 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -44,6 +44,7 @@ .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) .Attribute("return: NullAllowed", del => del.GetIdentifier() is "SentryBeforeBreadcrumbCallback" or "SentryBeforeSendEventCallback" or "SentryTracesSamplerCallback") + .Partial("SentryScope") .Blacklist( // error CS0246: The type or namespace name 'iOS' could not be found "iOS", @@ -246,6 +247,25 @@ public static CompilationUnitSyntax Rename( } return root.ReplaceNodes(replacements.Keys, (orig, _) => replacements[orig]); } + + public static CompilationUnitSyntax Partial( + this CompilationUnitSyntax root, + string name) + { + var iface = root.DescendantNodes() + .OfType() + .FirstOrDefault(i => i.Matches(name)); + + if (iface == null) + { + return root; + } + + return root.ReplaceNode( + iface, + iface.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword).WithTrailingTrivia(SyntaxFactory.Space)) + ); + } } internal static class SyntaxNodeExtensions From e366852275fd367defd2a097f1a41fe3569f8b48 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 13:10:19 +0100 Subject: [PATCH 18/36] MethodToProperty --- scripts/generate-cocoa-bindings.ps1 | 5 --- .../Program.cs | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 9bf4652935..06908211fc 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,11 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# 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|AppStartMeasurementWithSpans|BaggageHttpHeader) \{ get; \})', '$1' -$Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+) \{ get; \}', '$1();' - # Allow weakly typed NSArray # We have some that accept either NSString or NSRegularExpression, which have no common type so they use NSObject $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index db8732618a..900af913af 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -28,6 +28,12 @@ // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 .Blacklist("INSCopying") .Blacklist("") + // Fix/verify property-to-method conversions + .PropertyToMethod("Sentry*.Serialize") + .PropertyToMethod("SentrySpan.ToTraceHeader") + .PropertyToMethod("SentryTraceContext.ToBaggage") + .PropertyToMethod("PrivateSentrySDKOnly.Capture*") + .Blacklist("Verify") // TODO: MethodToProperty predicate // Fix delegate argument names .Rename("arg*", "error", p => p.Type?.ToString() == "NSError") .Rename("arg*", "response", p => p.Type?.ToString() == "NSHttpUrlResponse") @@ -266,6 +272,43 @@ public static CompilationUnitSyntax Partial( iface.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword).WithTrailingTrivia(SyntaxFactory.Space)) ); } + + public static CompilationUnitSyntax PropertyToMethod(this CompilationUnitSyntax root, string pattern) + { + var properties = root.DescendantNodes() + .OfType() + .Where(prop => + prop.AttributeLists.SelectMany(a => a.Attributes) + .Any(attr => attr.Name.ToString() == "Verify" && attr.ArgumentList?.Arguments.ToString().Contains("MethodToProperty") == true) && + prop.AccessorList != null && + prop.AccessorList.Accessors.Count == 1 && + prop.AccessorList.Accessors[0].Kind() == SyntaxKind.GetAccessorDeclaration && + prop.GetQualifiedName().Matches(pattern) + ); + + return root.ReplaceNodes(properties, (original, _) => + { + var newAttributes = SyntaxFactory.List( + original.AttributeLists + .Select(al => al.WithAttributes( + SyntaxFactory.SeparatedList( + al.Attributes.Where(attr => + !(attr.Name.ToString() == "Verify" && attr.ArgumentList?.Arguments.ToString().Contains("MethodToProperty") == true) + ) + ) + )) + .Where(al => al.Attributes.Count > 0) + ); + + return SyntaxFactory.MethodDeclaration(original.Type, SyntaxFactory.Identifier(original.Identifier.Text)) + .WithModifiers(original.Modifiers) + .WithAttributeLists(newAttributes) + .WithParameterList(SyntaxFactory.ParameterList()) + .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) + .WithLeadingTrivia(original.GetLeadingTrivia()) + .WithTrailingTrivia(original.GetTrailingTrivia()); + }); + } } internal static class SyntaxNodeExtensions From eda4876e59fff5370db883b6894a3c71191132ce Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 14:19:45 +0100 Subject: [PATCH 19/36] Format --- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 1800 +++++++++-------- .../Program.cs | 11 +- ...Sentry.Bindings.Cocoa.PostProcessor.csproj | 1 + 3 files changed, 910 insertions(+), 902 deletions(-) diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index b5e7df75bf..f771c7c400 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -16,163 +16,163 @@ namespace Sentry.CocoaSdk; // typedef void (^SentryRequestFinished)(NSError * _Nullable); [Internal] -delegate void SentryRequestFinished ([NullAllowed] NSError error); +delegate void SentryRequestFinished([NullAllowed] NSError error); // typedef void (^SentryRequestOperationFinished)(NSHTTPURLResponse * _Nullable, NSError * _Nullable); [Internal] -delegate void SentryRequestOperationFinished ([NullAllowed] NSHttpUrlResponse response, [NullAllowed] NSError error); +delegate void SentryRequestOperationFinished([NullAllowed] NSHttpUrlResponse response, [NullAllowed] NSError error); // typedef SentryBreadcrumb * _Nullable (^SentryBeforeBreadcrumbCallback)(SentryBreadcrumb * _Nonnull); [Internal] [return: NullAllowed] -delegate SentryBreadcrumb SentryBeforeBreadcrumbCallback (SentryBreadcrumb breadcrumb); +delegate SentryBreadcrumb SentryBeforeBreadcrumbCallback(SentryBreadcrumb breadcrumb); // typedef SentryEvent * _Nullable (^SentryBeforeSendEventCallback)(SentryEvent * _Nonnull); [Internal] [return: NullAllowed] -delegate SentryEvent SentryBeforeSendEventCallback (SentryEvent @event); +delegate SentryEvent SentryBeforeSendEventCallback(SentryEvent @event); // typedef id _Nullable (^SentryBeforeSendSpanCallback)(id _Nonnull); [Internal] -delegate SentrySpan SentryBeforeSendSpanCallback (SentrySpan span); +delegate SentrySpan SentryBeforeSendSpanCallback(SentrySpan span); // typedef SentryLog * _Nullable (^SentryBeforeSendLogCallback)(SentryLog * _Nonnull); [Internal] -delegate SentryLog SentryBeforeSendLogCallback (SentryLog log); +delegate SentryLog SentryBeforeSendLogCallback(SentryLog log); // typedef BOOL (^SentryBeforeCaptureScreenshotCallback)(SentryEvent * _Nonnull); [Internal] -delegate bool SentryBeforeCaptureScreenshotCallback (SentryEvent @event); +delegate bool SentryBeforeCaptureScreenshotCallback(SentryEvent @event); // typedef BOOL (^SentryBeforeCaptureViewHierarchyCallback)(SentryEvent * _Nonnull); [Internal] -delegate bool SentryBeforeCaptureViewHierarchyCallback (SentryEvent @event); +delegate bool SentryBeforeCaptureViewHierarchyCallback(SentryEvent @event); // typedef void (^SentryOnCrashedLastRunCallback)(SentryEvent * _Nonnull); [Internal] -delegate void SentryOnCrashedLastRunCallback (SentryEvent @event); +delegate void SentryOnCrashedLastRunCallback(SentryEvent @event); // typedef BOOL (^SentryShouldQueueEvent)(NSHTTPURLResponse * _Nullable, NSError * _Nullable); [Internal] -delegate bool SentryShouldQueueEvent ([NullAllowed] NSHttpUrlResponse response, [NullAllowed] NSError error); +delegate bool SentryShouldQueueEvent([NullAllowed] NSHttpUrlResponse response, [NullAllowed] NSError error); // typedef NSNumber * _Nullable (^SentryTracesSamplerCallback)(SentrySamplingContext * _Nonnull); [Internal] [return: NullAllowed] -delegate NSNumber SentryTracesSamplerCallback (SentrySamplingContext samplingContext); +delegate NSNumber SentryTracesSamplerCallback(SentrySamplingContext samplingContext); // typedef void (^SentrySpanCallback)(DEPRECATED_MSG_ATTRIBUTE("See `SentryScope.useSpan` for reasoning of deprecation.") id); [Internal] -delegate void SentrySpanCallback (SentrySpan span); +delegate void SentrySpanCallback(SentrySpan span); // @interface SentryAttachment : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryAttachment { // -(instancetype _Nonnull)initWithData:(NSData * _Nonnull)data filename:(NSString * _Nonnull)filename; - [Export ("initWithData:filename:")] - NativeHandle Constructor (NSData data, string filename); + [Export("initWithData:filename:")] + NativeHandle Constructor(NSData data, string filename); // -(instancetype _Nonnull)initWithData:(NSData * _Nonnull)data filename:(NSString * _Nonnull)filename contentType:(NSString * _Nullable)contentType; - [Export ("initWithData:filename:contentType:")] - NativeHandle Constructor (NSData data, string filename, [NullAllowed] string contentType); + [Export("initWithData:filename:contentType:")] + NativeHandle Constructor(NSData data, string filename, [NullAllowed] string contentType); // -(instancetype _Nonnull)initWithPath:(NSString * _Nonnull)path; - [Export ("initWithPath:")] - NativeHandle Constructor (string path); + [Export("initWithPath:")] + NativeHandle Constructor(string path); // -(instancetype _Nonnull)initWithPath:(NSString * _Nonnull)path filename:(NSString * _Nonnull)filename; - [Export ("initWithPath:filename:")] - NativeHandle Constructor (string path, string filename); + [Export("initWithPath:filename:")] + NativeHandle Constructor(string path, string filename); // -(instancetype _Nonnull)initWithPath:(NSString * _Nonnull)path filename:(NSString * _Nonnull)filename contentType:(NSString * _Nullable)contentType; - [Export ("initWithPath:filename:contentType:")] - NativeHandle Constructor (string path, string filename, [NullAllowed] string contentType); + [Export("initWithPath:filename:contentType:")] + NativeHandle Constructor(string path, string filename, [NullAllowed] string contentType); // @property (readonly, nonatomic, strong) NSData * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Strong)] + [NullAllowed, Export("data", ArgumentSemantic.Strong)] NSData Data { get; } // @property (readonly, copy, nonatomic) NSString * _Nullable path; - [NullAllowed, Export ("path")] + [NullAllowed, Export("path")] string Path { get; } // @property (readonly, copy, nonatomic) NSString * _Nonnull filename; - [Export ("filename")] + [Export("filename")] string Filename { get; } // @property (readonly, copy, nonatomic) NSString * _Nullable contentType; - [NullAllowed, Export ("contentType")] + [NullAllowed, Export("contentType")] string ContentType { get; } } // @interface SentryBaggage : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryBaggage { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; - [Export ("traceId")] + [Export("traceId")] SentryId TraceId { get; } // @property (readonly, nonatomic) NSString * _Nonnull publicKey; - [Export ("publicKey")] + [Export("publicKey")] string PublicKey { get; } // @property (readonly, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] + [NullAllowed, Export("releaseName")] string ReleaseName { get; } // @property (readonly, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] + [NullAllowed, Export("environment")] string Environment { get; } // @property (readonly, nonatomic) NSString * _Nullable transaction; - [NullAllowed, Export ("transaction")] + [NullAllowed, Export("transaction")] string Transaction { get; } // @property (readonly, nonatomic) NSString * _Nullable userId; - [NullAllowed, Export ("userId")] + [NullAllowed, Export("userId")] string UserId { get; } // @property (readonly, nonatomic) NSString * _Nullable userSegment; - [NullAllowed, Export ("userSegment")] + [NullAllowed, Export("userSegment")] string UserSegment { get; } // @property (readonly, nonatomic) NSString * _Nullable sampleRand; - [NullAllowed, Export ("sampleRand")] + [NullAllowed, Export("sampleRand")] string SampleRand { get; } // @property (readonly, nonatomic) NSString * _Nullable sampleRate; - [NullAllowed, Export ("sampleRate")] + [NullAllowed, Export("sampleRate")] string SampleRate { get; } // @property (nonatomic, strong) NSString * _Nullable sampled; - [NullAllowed, Export ("sampled", ArgumentSemantic.Strong)] + [NullAllowed, Export("sampled", ArgumentSemantic.Strong)] string Sampled { get; set; } // @property (nonatomic, strong) NSString * _Nullable replayId; - [NullAllowed, Export ("replayId", ArgumentSemantic.Strong)] + [NullAllowed, Export("replayId", ArgumentSemantic.Strong)] string ReplayId { get; set; } // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; - [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] - NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); + [Export("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] + NativeHandle Constructor(SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampleRand:(NSString * _Nullable)sampleRand sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; - [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] - NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); + [Export("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] + NativeHandle Constructor(SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); // -(NSString * _Nonnull)toHTTPHeaderWithOriginalBaggage:(NSDictionary * _Nullable)originalBaggage; - [Export ("toHTTPHeaderWithOriginalBaggage:")] - string ToHTTPHeaderWithOriginalBaggage ([NullAllowed] NSDictionary originalBaggage); + [Export("toHTTPHeaderWithOriginalBaggage:")] + string ToHTTPHeaderWithOriginalBaggage([NullAllowed] NSDictionary originalBaggage); } // @protocol SentrySerializable [Protocol] -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] [Model] @@ -180,557 +180,558 @@ interface ISentrySerializable { // @required -(NSDictionary * _Nonnull)serialize; [Abstract] - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); } // @interface SentryBreadcrumb : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryBreadcrumb : ISentrySerializable { // @property (nonatomic) SentryLevel level; - [Export ("level", ArgumentSemantic.Assign)] + [Export("level", ArgumentSemantic.Assign)] SentryLevel Level { get; set; } // @property (copy, nonatomic) NSString * _Nonnull category; - [Export ("category")] + [Export("category")] string Category { get; set; } // @property (nonatomic, strong) NSDate * _Nullable timestamp; - [NullAllowed, Export ("timestamp", ArgumentSemantic.Strong)] + [NullAllowed, Export("timestamp", ArgumentSemantic.Strong)] NSDate Timestamp { get; set; } // @property (copy, nonatomic) NSString * _Nullable type; - [NullAllowed, Export ("type")] + [NullAllowed, Export("type")] string Type { get; set; } // @property (copy, nonatomic) NSString * _Nullable message; - [NullAllowed, Export ("message")] + [NullAllowed, Export("message")] string Message { get; set; } // @property (copy, nonatomic) NSString * _Nullable origin; - [NullAllowed, Export ("origin")] + [NullAllowed, Export("origin")] string Origin { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Strong)] + [NullAllowed, Export("data", ArgumentSemantic.Strong)] NSDictionary Data { get; set; } // -(instancetype _Nonnull)initWithLevel:(SentryLevel)level category:(NSString * _Nonnull)category; - [Export ("initWithLevel:category:")] - NativeHandle Constructor (SentryLevel level, string category); + [Export("initWithLevel:category:")] + NativeHandle Constructor(SentryLevel level, string category); // -(NSDictionary * _Nonnull)serialize; - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); // -(BOOL)isEqualToBreadcrumb:(SentryBreadcrumb * _Nonnull)breadcrumb; - [Export ("isEqualToBreadcrumb:")] - bool IsEqualToBreadcrumb (SentryBreadcrumb breadcrumb); + [Export("isEqualToBreadcrumb:")] + bool IsEqualToBreadcrumb(SentryBreadcrumb breadcrumb); // -(NSUInteger)hash; - [Export ("hash")] + [Export("hash")] nuint Hash { get; } } // @interface SentryClient : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryClient { // @property (readonly, assign, nonatomic) BOOL isEnabled; - [Export ("isEnabled")] + [Export("isEnabled")] bool IsEnabled { get; } // @property (nonatomic, strong) SentryOptions * _Nonnull options; - [Export ("options", ArgumentSemantic.Strong)] + [Export("options", ArgumentSemantic.Strong)] SentryOptions Options { get; set; } // -(instancetype _Nullable)initWithOptions:(SentryOptions * _Nonnull)options; - [Export ("initWithOptions:")] - NativeHandle Constructor (SentryOptions options); + [Export("initWithOptions:")] + NativeHandle Constructor(SentryOptions options); // -(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event __attribute__((swift_name("capture(event:)"))); - [Export ("captureEvent:")] - SentryId CaptureEvent (SentryEvent @event); + [Export("captureEvent:")] + SentryId CaptureEvent(SentryEvent @event); // -(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(event:scope:)"))); - [Export ("captureEvent:withScope:")] - SentryId CaptureEvent (SentryEvent @event, SentryScope scope); + [Export("captureEvent:withScope:")] + SentryId CaptureEvent(SentryEvent @event, SentryScope scope); // -(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error __attribute__((swift_name("capture(error:)"))); - [Export ("captureError:")] - SentryId CaptureError (NSError error); + [Export("captureError:")] + SentryId CaptureError(NSError error); // -(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(error:scope:)"))); - [Export ("captureError:withScope:")] - SentryId CaptureError (NSError error, SentryScope scope); + [Export("captureError:withScope:")] + SentryId CaptureError(NSError error, SentryScope scope); // -(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception __attribute__((swift_name("capture(exception:)"))); - [Export ("captureException:")] - SentryId CaptureException (NSException exception); + [Export("captureException:")] + SentryId CaptureException(NSException exception); // -(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(exception:scope:)"))); - [Export ("captureException:withScope:")] - SentryId CaptureException (NSException exception, SentryScope scope); + [Export("captureException:withScope:")] + SentryId CaptureException(NSException exception, SentryScope scope); // -(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message __attribute__((swift_name("capture(message:)"))); - [Export ("captureMessage:")] - SentryId CaptureMessage (string message); + [Export("captureMessage:")] + SentryId CaptureMessage(string message); // -(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(message:scope:)"))); - [Export ("captureMessage:withScope:")] - SentryId CaptureMessage (string message, SentryScope scope); + [Export("captureMessage:withScope:")] + SentryId CaptureMessage(string message, SentryScope scope); // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(feedback:scope:)"))); - [Export ("captureFeedback:withScope:")] - void CaptureFeedback (SentryFeedback feedback, SentryScope scope); + [Export("captureFeedback:withScope:")] + void CaptureFeedback(SentryFeedback feedback, SentryScope scope); // -(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)"))); - [Export ("flush:")] - void Flush (double timeout); + [Export("flush:")] + void Flush(double timeout); // -(void)close; - [Export ("close")] - void Close (); + [Export("close")] + void Close(); } // @interface SentryDebugImageProvider : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryDebugImageProvider { // -(NSArray * _Nonnull)getDebugImagesForThreads:(NSArray * _Nonnull)threads __attribute__((deprecated("Use -[getDebugImagesForThreads:isCrash:] instead."))); - [Export ("getDebugImagesForThreads:")] - SentryDebugMeta[] GetDebugImagesForThreads (SentryThread[] threads); + [Export("getDebugImagesForThreads:")] + SentryDebugMeta[] GetDebugImagesForThreads(SentryThread[] threads); // -(NSArray * _Nonnull)getDebugImagesForThreads:(NSArray * _Nonnull)threads isCrash:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCacheForThreads:] instead."))); - [Export ("getDebugImagesForThreads:isCrash:")] - SentryDebugMeta[] GetDebugImagesForThreads (SentryThread[] threads, bool isCrash); + [Export("getDebugImagesForThreads:isCrash:")] + SentryDebugMeta[] GetDebugImagesForThreads(SentryThread[] threads, bool isCrash); // -(NSArray * _Nonnull)getDebugImagesForFrames:(NSArray * _Nonnull)frames __attribute__((deprecated("Use -[getDebugImagesForFrames:isCrash:] instead."))); - [Export ("getDebugImagesForFrames:")] - SentryDebugMeta[] GetDebugImagesForFrames (SentryFrame[] frames); + [Export("getDebugImagesForFrames:")] + SentryDebugMeta[] GetDebugImagesForFrames(SentryFrame[] frames); // -(NSArray * _Nonnull)getDebugImagesForFrames:(NSArray * _Nonnull)frames isCrash:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCacheForFrames:] instead."))); - [Export ("getDebugImagesForFrames:isCrash:")] - SentryDebugMeta[] GetDebugImagesForFrames (SentryFrame[] frames, bool isCrash); + [Export("getDebugImagesForFrames:isCrash:")] + SentryDebugMeta[] GetDebugImagesForFrames(SentryFrame[] frames, bool isCrash); // -(NSArray * _Nonnull)getDebugImages __attribute__((deprecated("Use -[getDebugImagesCrashed:] instead."))); - [Export ("getDebugImages")] + [Export("getDebugImages")] SentryDebugMeta[] DebugImages { get; } // -(NSArray * _Nonnull)getDebugImagesCrashed:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCache:] instead."))); - [Export ("getDebugImagesCrashed:")] - SentryDebugMeta[] GetDebugImagesCrashed (bool isCrash); + [Export("getDebugImagesCrashed:")] + SentryDebugMeta[] GetDebugImagesCrashed(bool isCrash); } // @interface SentryDebugMeta : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryDebugMeta : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nullable uuid; - [NullAllowed, Export ("uuid")] + [NullAllowed, Export("uuid")] string Uuid { get; set; } // @property (copy, nonatomic) NSString * _Nullable debugID; - [NullAllowed, Export ("debugID")] + [NullAllowed, Export("debugID")] string DebugID { get; set; } // @property (copy, nonatomic) NSString * _Nullable type; - [NullAllowed, Export ("type")] + [NullAllowed, Export("type")] string Type { get; set; } // @property (copy, nonatomic) NSString * _Nullable name; - [NullAllowed, Export ("name")] + [NullAllowed, Export("name")] string Name { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable imageSize; - [NullAllowed, Export ("imageSize", ArgumentSemantic.Copy)] + [NullAllowed, Export("imageSize", ArgumentSemantic.Copy)] NSNumber ImageSize { get; set; } // @property (copy, nonatomic) NSString * _Nullable imageAddress; - [NullAllowed, Export ("imageAddress")] + [NullAllowed, Export("imageAddress")] string ImageAddress { get; set; } // @property (copy, nonatomic) NSString * _Nullable imageVmAddress; - [NullAllowed, Export ("imageVmAddress")] + [NullAllowed, Export("imageVmAddress")] string ImageVmAddress { get; set; } // @property (copy, nonatomic) NSString * _Nullable codeFile; - [NullAllowed, Export ("codeFile")] + [NullAllowed, Export("codeFile")] string CodeFile { get; set; } } // @interface SentryDsn : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryDsn { // @property (readonly, nonatomic, strong) NSURL * _Nonnull url; - [Export ("url", ArgumentSemantic.Strong)] + [Export("url", ArgumentSemantic.Strong)] NSUrl Url { get; } // -(instancetype _Nullable)initWithString:(NSString * _Nonnull)dsnString didFailWithError:(NSError * _Nullable * _Nullable)error; - [Export ("initWithString:didFailWithError:")] - NativeHandle Constructor (string dsnString, [NullAllowed] out NSError error); + [Export("initWithString:didFailWithError:")] + NativeHandle Constructor(string dsnString, [NullAllowed] out NSError error); // -(NSString * _Nonnull)getHash; - [Export ("getHash")] + [Export("getHash")] string Hash { get; } // -(NSURL * _Nonnull)getStoreEndpoint __attribute__((deprecated("This endpoint is no longer used"))); - [Export ("getStoreEndpoint")] + [Export("getStoreEndpoint")] NSUrl StoreEndpoint { get; } // -(NSURL * _Nonnull)getEnvelopeEndpoint; - [Export ("getEnvelopeEndpoint")] + [Export("getEnvelopeEndpoint")] NSUrl EnvelopeEndpoint { get; } } // @interface SentryEvent : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryEvent : ISentrySerializable { // @property (nonatomic, strong) SentryId * _Nonnull eventId; - [Export ("eventId", ArgumentSemantic.Strong)] + [Export("eventId", ArgumentSemantic.Strong)] SentryId EventId { get; set; } // @property (nonatomic, strong) SentryMessage * _Nullable message; - [NullAllowed, Export ("message", ArgumentSemantic.Strong)] + [NullAllowed, Export("message", ArgumentSemantic.Strong)] SentryMessage Message { get; set; } // @property (copy, nonatomic) NSError * _Nullable error; - [NullAllowed, Export ("error", ArgumentSemantic.Copy)] + [NullAllowed, Export("error", ArgumentSemantic.Copy)] NSError Error { get; set; } // @property (nonatomic, strong) NSDate * _Nullable timestamp; - [NullAllowed, Export ("timestamp", ArgumentSemantic.Strong)] + [NullAllowed, Export("timestamp", ArgumentSemantic.Strong)] NSDate Timestamp { get; set; } // @property (nonatomic, strong) NSDate * _Nullable startTimestamp; - [NullAllowed, Export ("startTimestamp", ArgumentSemantic.Strong)] + [NullAllowed, Export("startTimestamp", ArgumentSemantic.Strong)] NSDate StartTimestamp { get; set; } // @property (nonatomic) enum SentryLevel level; - [Export ("level", ArgumentSemantic.Assign)] + [Export("level", ArgumentSemantic.Assign)] SentryLevel Level { get; set; } // @property (copy, nonatomic) NSString * _Nonnull platform; - [Export ("platform")] + [Export("platform")] string Platform { get; set; } // @property (copy, nonatomic) NSString * _Nullable logger; - [NullAllowed, Export ("logger")] + [NullAllowed, Export("logger")] string Logger { get; set; } // @property (copy, nonatomic) NSString * _Nullable serverName; - [NullAllowed, Export ("serverName")] + [NullAllowed, Export("serverName")] string ServerName { get; set; } // @property (copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] + [NullAllowed, Export("releaseName")] string ReleaseName { get; set; } // @property (copy, nonatomic) NSString * _Nullable dist; - [NullAllowed, Export ("dist")] + [NullAllowed, Export("dist")] string Dist { get; set; } // @property (copy, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] + [NullAllowed, Export("environment")] string Environment { get; set; } // @property (copy, nonatomic) NSString * _Nullable transaction; - [NullAllowed, Export ("transaction")] + [NullAllowed, Export("transaction")] string Transaction { get; set; } // @property (copy, nonatomic) NSString * _Nullable type; - [NullAllowed, Export ("type")] + [NullAllowed, Export("type")] string Type { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable tags; - [NullAllowed, Export ("tags", ArgumentSemantic.Strong)] + [NullAllowed, Export("tags", ArgumentSemantic.Strong)] NSDictionary Tags { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable extra; - [NullAllowed, Export ("extra", ArgumentSemantic.Strong)] + [NullAllowed, Export("extra", ArgumentSemantic.Strong)] NSDictionary Extra { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable sdk; - [NullAllowed, Export ("sdk", ArgumentSemantic.Strong)] + [NullAllowed, Export("sdk", ArgumentSemantic.Strong)] NSDictionary Sdk { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable modules; - [NullAllowed, Export ("modules", ArgumentSemantic.Strong)] + [NullAllowed, Export("modules", ArgumentSemantic.Strong)] NSDictionary Modules { get; set; } // @property (nonatomic, strong) NSArray * _Nullable fingerprint; - [NullAllowed, Export ("fingerprint", ArgumentSemantic.Strong)] + [NullAllowed, Export("fingerprint", ArgumentSemantic.Strong)] string[] Fingerprint { get; set; } // @property (nonatomic, strong) SentryUser * _Nullable user; - [NullAllowed, Export ("user", ArgumentSemantic.Strong)] + [NullAllowed, Export("user", ArgumentSemantic.Strong)] SentryUser User { get; set; } // @property (nonatomic, strong) NSDictionary *> * _Nullable context; - [NullAllowed, Export ("context", ArgumentSemantic.Strong)] + [NullAllowed, Export("context", ArgumentSemantic.Strong)] NSDictionary> Context { get; set; } // @property (nonatomic, strong) NSArray * _Nullable threads; - [NullAllowed, Export ("threads", ArgumentSemantic.Strong)] + [NullAllowed, Export("threads", ArgumentSemantic.Strong)] SentryThread[] Threads { get; set; } // @property (nonatomic, strong) NSArray * _Nullable exceptions; - [NullAllowed, Export ("exceptions", ArgumentSemantic.Strong)] + [NullAllowed, Export("exceptions", ArgumentSemantic.Strong)] SentryException[] Exceptions { get; set; } // @property (nonatomic, strong) SentryStacktrace * _Nullable stacktrace; - [NullAllowed, Export ("stacktrace", ArgumentSemantic.Strong)] + [NullAllowed, Export("stacktrace", ArgumentSemantic.Strong)] SentryStacktrace Stacktrace { get; set; } // @property (nonatomic, strong) NSArray * _Nullable debugMeta; - [NullAllowed, Export ("debugMeta", ArgumentSemantic.Strong)] + [NullAllowed, Export("debugMeta", ArgumentSemantic.Strong)] SentryDebugMeta[] DebugMeta { get; set; } // @property (nonatomic, strong) NSArray * _Nullable breadcrumbs; - [NullAllowed, Export ("breadcrumbs", ArgumentSemantic.Strong)] + [NullAllowed, Export("breadcrumbs", ArgumentSemantic.Strong)] SentryBreadcrumb[] Breadcrumbs { get; set; } // @property (nonatomic, strong) SentryRequest * _Nullable request; - [NullAllowed, Export ("request", ArgumentSemantic.Strong)] + [NullAllowed, Export("request", ArgumentSemantic.Strong)] SentryRequest Request { get; set; } // -(instancetype _Nonnull)initWithLevel:(enum SentryLevel)level __attribute__((objc_designated_initializer)); - [Export ("initWithLevel:")] + [Export("initWithLevel:")] [DesignatedInitializer] - NativeHandle Constructor (SentryLevel level); + NativeHandle Constructor(SentryLevel level); // -(instancetype _Nonnull)initWithError:(NSError * _Nonnull)error; - [Export ("initWithError:")] - NativeHandle Constructor (NSError error); + [Export("initWithError:")] + NativeHandle Constructor(NSError error); } // @interface SentryException : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryException : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull value; - [Export ("value")] + [Export("value")] string Value { get; set; } // @property (copy, nonatomic) NSString * _Nonnull type; - [Export ("type")] + [Export("type")] string Type { get; set; } // @property (nonatomic, strong) SentryMechanism * _Nullable mechanism; - [NullAllowed, Export ("mechanism", ArgumentSemantic.Strong)] + [NullAllowed, Export("mechanism", ArgumentSemantic.Strong)] SentryMechanism Mechanism { get; set; } // @property (copy, nonatomic) NSString * _Nullable module; - [NullAllowed, Export ("module")] + [NullAllowed, Export("module")] string Module { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable threadId; - [NullAllowed, Export ("threadId", ArgumentSemantic.Copy)] + [NullAllowed, Export("threadId", ArgumentSemantic.Copy)] NSNumber ThreadId { get; set; } // @property (nonatomic, strong) SentryStacktrace * _Nullable stacktrace; - [NullAllowed, Export ("stacktrace", ArgumentSemantic.Strong)] + [NullAllowed, Export("stacktrace", ArgumentSemantic.Strong)] SentryStacktrace Stacktrace { get; set; } // -(instancetype _Nonnull)initWithValue:(NSString * _Nonnull)value type:(NSString * _Nonnull)type; - [Export ("initWithValue:type:")] - NativeHandle Constructor (string value, string type); + [Export("initWithValue:type:")] + NativeHandle Constructor(string value, string type); } // @interface SentryFeedbackAPI : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryFeedbackAPI { - [Export ("showWidget")] - void ShowWidget (); - [Export ("hideWidget")] - void HideWidget (); + [Export("showWidget")] + void ShowWidget(); + [Export("hideWidget")] + void HideWidget(); } // @interface SentryFrame : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryFrame : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nullable symbolAddress; - [NullAllowed, Export ("symbolAddress")] + [NullAllowed, Export("symbolAddress")] string SymbolAddress { get; set; } // @property (copy, nonatomic) NSString * _Nullable fileName; - [NullAllowed, Export ("fileName")] + [NullAllowed, Export("fileName")] string FileName { get; set; } // @property (copy, nonatomic) NSString * _Nullable function; - [NullAllowed, Export ("function")] + [NullAllowed, Export("function")] string Function { get; set; } // @property (copy, nonatomic) NSString * _Nullable module; - [NullAllowed, Export ("module")] + [NullAllowed, Export("module")] string Module { get; set; } // @property (copy, nonatomic) NSString * _Nullable package; - [NullAllowed, Export ("package")] + [NullAllowed, Export("package")] string Package { get; set; } // @property (copy, nonatomic) NSString * _Nullable imageAddress; - [NullAllowed, Export ("imageAddress")] + [NullAllowed, Export("imageAddress")] string ImageAddress { get; set; } // @property (copy, nonatomic) NSString * _Nullable platform; - [NullAllowed, Export ("platform")] + [NullAllowed, Export("platform")] string Platform { get; set; } // @property (copy, nonatomic) NSString * _Nullable instructionAddress; - [NullAllowed, Export ("instructionAddress")] + [NullAllowed, Export("instructionAddress")] string InstructionAddress { get; set; } // @property (nonatomic) NSUInteger instruction; - [Export ("instruction")] + [Export("instruction")] nuint Instruction { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable lineNumber; - [NullAllowed, Export ("lineNumber", ArgumentSemantic.Copy)] + [NullAllowed, Export("lineNumber", ArgumentSemantic.Copy)] NSNumber LineNumber { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable columnNumber; - [NullAllowed, Export ("columnNumber", ArgumentSemantic.Copy)] + [NullAllowed, Export("columnNumber", ArgumentSemantic.Copy)] NSNumber ColumnNumber { get; set; } // @property (copy, nonatomic) NSString * _Nullable contextLine; - [NullAllowed, Export ("contextLine")] + [NullAllowed, Export("contextLine")] string ContextLine { get; set; } // @property (copy, nonatomic) NSArray * _Nullable preContext; - [NullAllowed, Export ("preContext", ArgumentSemantic.Copy)] + [NullAllowed, Export("preContext", ArgumentSemantic.Copy)] string[] PreContext { get; set; } // @property (copy, nonatomic) NSArray * _Nullable postContext; - [NullAllowed, Export ("postContext", ArgumentSemantic.Copy)] + [NullAllowed, Export("postContext", ArgumentSemantic.Copy)] string[] PostContext { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable inApp; - [NullAllowed, Export ("inApp", ArgumentSemantic.Copy)] + [NullAllowed, Export("inApp", ArgumentSemantic.Copy)] NSNumber InApp { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable stackStart; - [NullAllowed, Export ("stackStart", ArgumentSemantic.Copy)] + [NullAllowed, Export("stackStart", ArgumentSemantic.Copy)] NSNumber StackStart { get; set; } // @property (copy, nonatomic) NSDictionary * _Nullable vars; - [NullAllowed, Export ("vars", ArgumentSemantic.Copy)] + [NullAllowed, Export("vars", ArgumentSemantic.Copy)] NSDictionary Vars { get; set; } } // @interface SentryGeo : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] -interface SentryGeo : ISentrySerializable{ +interface SentryGeo : ISentrySerializable +{ // @property (copy, atomic) NSString * _Nullable city; - [NullAllowed, Export ("city")] + [NullAllowed, Export("city")] string City { get; set; } // @property (copy, atomic) NSString * _Nullable countryCode; - [NullAllowed, Export ("countryCode")] + [NullAllowed, Export("countryCode")] string CountryCode { get; set; } // @property (copy, atomic) NSString * _Nullable region; - [NullAllowed, Export ("region")] + [NullAllowed, Export("region")] string Region { get; set; } // -(BOOL)isEqualToGeo:(SentryGeo * _Nonnull)geo; - [Export ("isEqualToGeo:")] - bool IsEqualToGeo (SentryGeo geo); + [Export("isEqualToGeo:")] + bool IsEqualToGeo(SentryGeo geo); // -(NSUInteger)hash; - [Export ("hash")] + [Export("hash")] nuint Hash { get; } } // @interface SentryHttpStatusCodeRange : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryHttpStatusCodeRange { // @property (readonly, nonatomic) NSInteger min; - [Export ("min")] + [Export("min")] nint Min { get; } // @property (readonly, nonatomic) NSInteger max; - [Export ("max")] + [Export("max")] nint Max { get; } // -(instancetype _Nonnull)initWithMin:(NSInteger)min max:(NSInteger)max; - [Export ("initWithMin:max:")] - NativeHandle Constructor (nint min, nint max); + [Export("initWithMin:max:")] + NativeHandle Constructor(nint min, nint max); // -(instancetype _Nonnull)initWithStatusCode:(NSInteger)statusCode; - [Export ("initWithStatusCode:")] - NativeHandle Constructor (nint statusCode); + [Export("initWithStatusCode:")] + NativeHandle Constructor(nint statusCode); } // @interface SentrySpanContext : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentrySpanContext : ISentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; - [Export ("traceId")] + [Export("traceId")] SentryId TraceId { get; } // @property (readonly, nonatomic) SentrySpanId * _Nonnull spanId; - [Export ("spanId")] + [Export("spanId")] SentrySpanId SpanId { get; } // @property (readonly, nonatomic) SentrySpanId * _Nullable parentSpanId; - [NullAllowed, Export ("parentSpanId")] + [NullAllowed, Export("parentSpanId")] SentrySpanId ParentSpanId { get; } // @property (readonly, nonatomic) SentrySampleDecision sampled; - [Export ("sampled")] + [Export("sampled")] SentrySampleDecision Sampled { get; } // @property (readonly, copy, nonatomic) NSString * _Nonnull operation; - [Export ("operation")] + [Export("operation")] string Operation { get; } // @property (readonly, copy, nonatomic) NSString * _Nullable spanDescription; - [NullAllowed, Export ("spanDescription")] + [NullAllowed, Export("spanDescription")] string SpanDescription { get; } // @property (copy, nonatomic) NSString * _Nonnull origin; - [Export ("origin")] + [Export("origin")] string Origin { get; set; } // -(instancetype _Nonnull)initWithOperation:(NSString * _Nonnull)operation; - [Export ("initWithOperation:")] - NativeHandle Constructor (string operation); + [Export("initWithOperation:")] + NativeHandle Constructor(string operation); // -(instancetype _Nonnull)initWithOperation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled; - [Export ("initWithOperation:sampled:")] - NativeHandle Constructor (string operation, SentrySampleDecision sampled); + [Export("initWithOperation:sampled:")] + NativeHandle Constructor(string operation, SentrySampleDecision sampled); // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentId:(SentrySpanId * _Nullable)parentId operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled; - [Export ("initWithTraceId:spanId:parentId:operation:sampled:")] - NativeHandle Constructor (SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentId, string operation, SentrySampleDecision sampled); + [Export("initWithTraceId:spanId:parentId:operation:sampled:")] + NativeHandle Constructor(SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentId, string operation, SentrySampleDecision sampled); // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentId:(SentrySpanId * _Nullable)parentId operation:(NSString * _Nonnull)operation spanDescription:(NSString * _Nullable)description sampled:(SentrySampleDecision)sampled; - [Export ("initWithTraceId:spanId:parentId:operation:spanDescription:sampled:")] - NativeHandle Constructor (SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentId, string operation, [NullAllowed] string description, SentrySampleDecision sampled); + [Export("initWithTraceId:spanId:parentId:operation:spanDescription:sampled:")] + NativeHandle Constructor(SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentId, string operation, [NullAllowed] string description, SentrySampleDecision sampled); } // @protocol SentrySpan @@ -742,1526 +743,1529 @@ interface SentrySpan : ISentrySerializable { // @required @property (nonatomic, strong) SentryId * _Nonnull traceId; [Abstract] - [Export ("traceId", ArgumentSemantic.Strong)] + [Export("traceId", ArgumentSemantic.Strong)] SentryId TraceId { get; set; } // @required @property (nonatomic, strong) SentrySpanId * _Nonnull spanId; [Abstract] - [Export ("spanId", ArgumentSemantic.Strong)] + [Export("spanId", ArgumentSemantic.Strong)] SentrySpanId SpanId { get; set; } // @required @property (nonatomic, strong) SentrySpanId * _Nullable parentSpanId; [Abstract] - [NullAllowed, Export ("parentSpanId", ArgumentSemantic.Strong)] + [NullAllowed, Export("parentSpanId", ArgumentSemantic.Strong)] SentrySpanId ParentSpanId { get; set; } // @required @property (nonatomic) SentrySampleDecision sampled; [Abstract] - [Export ("sampled", ArgumentSemantic.Assign)] + [Export("sampled", ArgumentSemantic.Assign)] SentrySampleDecision Sampled { get; set; } // @required @property (copy, nonatomic) NSString * _Nonnull operation; [Abstract] - [Export ("operation")] + [Export("operation")] string Operation { get; set; } // @required @property (copy, nonatomic) NSString * _Nonnull origin; [Abstract] - [Export ("origin")] + [Export("origin")] string Origin { get; set; } // @required @property (copy, nonatomic) NSString * _Nullable spanDescription; [Abstract] - [NullAllowed, Export ("spanDescription")] + [NullAllowed, Export("spanDescription")] string SpanDescription { get; set; } // @required @property (nonatomic) SentrySpanStatus status; [Abstract] - [Export ("status", ArgumentSemantic.Assign)] + [Export("status", ArgumentSemantic.Assign)] SentrySpanStatus Status { get; set; } // @required @property (nonatomic, strong) NSDate * _Nullable timestamp; [Abstract] - [NullAllowed, Export ("timestamp", ArgumentSemantic.Strong)] + [NullAllowed, Export("timestamp", ArgumentSemantic.Strong)] NSDate Timestamp { get; set; } // @required @property (nonatomic, strong) NSDate * _Nullable startTimestamp; [Abstract] - [NullAllowed, Export ("startTimestamp", ArgumentSemantic.Strong)] + [NullAllowed, Export("startTimestamp", ArgumentSemantic.Strong)] NSDate StartTimestamp { get; set; } // @required @property (readonly) NSDictionary * _Nonnull data; [Abstract] - [Export ("data")] + [Export("data")] NSDictionary Data { get; } // @required @property (readonly) NSDictionary * _Nonnull tags; [Abstract] - [Export ("tags")] + [Export("tags")] NSDictionary Tags { get; } // @required @property (readonly) BOOL isFinished; [Abstract] - [Export ("isFinished")] + [Export("isFinished")] bool IsFinished { get; } // @required @property (readonly, nonatomic) SentryTraceContext * _Nullable traceContext; [Abstract] - [NullAllowed, Export ("traceContext")] + [NullAllowed, Export("traceContext")] SentryTraceContext TraceContext { get; } // @required -(id _Nonnull)startChildWithOperation:(NSString * _Nonnull)operation __attribute__((swift_name("startChild(operation:)"))); [Abstract] - [Export ("startChildWithOperation:")] - SentrySpan StartChildWithOperation (string operation); + [Export("startChildWithOperation:")] + SentrySpan StartChildWithOperation(string operation); // @required -(id _Nonnull)startChildWithOperation:(NSString * _Nonnull)operation description:(NSString * _Nullable)description __attribute__((swift_name("startChild(operation:description:)"))); [Abstract] - [Export ("startChildWithOperation:description:")] - SentrySpan StartChildWithOperation (string operation, [NullAllowed] string description); + [Export("startChildWithOperation:description:")] + SentrySpan StartChildWithOperation(string operation, [NullAllowed] string description); // @required -(void)setDataValue:(id _Nullable)value forKey:(NSString * _Nonnull)key __attribute__((swift_name("setData(value:key:)"))); [Abstract] - [Export ("setDataValue:forKey:")] - void SetDataValue ([NullAllowed] NSObject value, string key); + [Export("setDataValue:forKey:")] + void SetDataValue([NullAllowed] NSObject value, string key); // @required -(void)setExtraValue:(id _Nullable)value forKey:(NSString * _Nonnull)key __attribute__((deprecated(""))) __attribute__((swift_name("setExtra(value:key:)"))); [Abstract] - [Export ("setExtraValue:forKey:")] - void SetExtraValue ([NullAllowed] NSObject value, string key); + [Export("setExtraValue:forKey:")] + void SetExtraValue([NullAllowed] NSObject value, string key); // @required -(void)removeDataForKey:(NSString * _Nonnull)key __attribute__((swift_name("removeData(key:)"))); [Abstract] - [Export ("removeDataForKey:")] - void RemoveDataForKey (string key); + [Export("removeDataForKey:")] + void RemoveDataForKey(string key); // @required -(void)setTagValue:(NSString * _Nonnull)value forKey:(NSString * _Nonnull)key __attribute__((swift_name("setTag(value:key:)"))); [Abstract] - [Export ("setTagValue:forKey:")] - void SetTagValue (string value, string key); + [Export("setTagValue:forKey:")] + void SetTagValue(string value, string key); // @required -(void)removeTagForKey:(NSString * _Nonnull)key __attribute__((swift_name("removeTag(key:)"))); [Abstract] - [Export ("removeTagForKey:")] - void RemoveTagForKey (string key); + [Export("removeTagForKey:")] + void RemoveTagForKey(string key); // @required -(void)setMeasurement:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value __attribute__((swift_name("setMeasurement(name:value:)"))); [Abstract] - [Export ("setMeasurement:value:")] - void SetMeasurement (string name, NSNumber value); + [Export("setMeasurement:value:")] + void SetMeasurement(string name, NSNumber value); // @required -(void)setMeasurement:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value unit:(SentryMeasurementUnit * _Nonnull)unit __attribute__((swift_name("setMeasurement(name:value:unit:)"))); [Abstract] - [Export ("setMeasurement:value:unit:")] - void SetMeasurement (string name, NSNumber value, SentryMeasurementUnit unit); + [Export("setMeasurement:value:unit:")] + void SetMeasurement(string name, NSNumber value, SentryMeasurementUnit unit); // @required -(void)finish; [Abstract] - [Export ("finish")] - void Finish (); + [Export("finish")] + void Finish(); // @required -(void)finishWithStatus:(SentrySpanStatus)status __attribute__((swift_name("finish(status:)"))); [Abstract] - [Export ("finishWithStatus:")] - void FinishWithStatus (SentrySpanStatus status); + [Export("finishWithStatus:")] + void FinishWithStatus(SentrySpanStatus status); // @required -(SentryTraceHeader * _Nonnull)toTraceHeader; [Abstract] - [Export ("toTraceHeader")] + [Export("toTraceHeader")] SentryTraceHeader ToTraceHeader(); // @required -(NSString * _Nullable)baggageHttpHeader; [Abstract] - [NullAllowed, Export ("baggageHttpHeader")] + [NullAllowed, Export("baggageHttpHeader")] string BaggageHttpHeader { get; } // @required -(NSDictionary * _Nonnull)serialize; [Abstract] - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); } // @interface SentryHub : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryHub { // -(instancetype _Nonnull)initWithClient:(SentryClient * _Nullable)client andScope:(SentryScope * _Nullable)scope; - [Export ("initWithClient:andScope:")] - NativeHandle Constructor ([NullAllowed] SentryClient client, [NullAllowed] SentryScope scope); + [Export("initWithClient:andScope:")] + NativeHandle Constructor([NullAllowed] SentryClient client, [NullAllowed] SentryScope scope); // -(void)startSession; - [Export ("startSession")] - void StartSession (); + [Export("startSession")] + void StartSession(); // -(void)endSession; - [Export ("endSession")] - void EndSession (); + [Export("endSession")] + void EndSession(); // -(void)endSessionWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionWithTimestamp:")] - void EndSessionWithTimestamp (NSDate timestamp); + [Export("endSessionWithTimestamp:")] + void EndSessionWithTimestamp(NSDate timestamp); // -(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event __attribute__((swift_name("capture(event:)"))); - [Export ("captureEvent:")] - SentryId CaptureEvent (SentryEvent @event); + [Export("captureEvent:")] + SentryId CaptureEvent(SentryEvent @event); // -(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(event:scope:)"))); - [Export ("captureEvent:withScope:")] - SentryId CaptureEvent (SentryEvent @event, SentryScope scope); + [Export("captureEvent:withScope:")] + SentryId CaptureEvent(SentryEvent @event, SentryScope scope); // -(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation __attribute__((swift_name("startTransaction(name:operation:)"))); - [Export ("startTransactionWithName:operation:")] - SentrySpan StartTransactionWithName (string name, string operation); + [Export("startTransactionWithName:operation:")] + SentrySpan StartTransactionWithName(string name, string operation); // -(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope __attribute__((swift_name("startTransaction(name:operation:bindToScope:)"))); - [Export ("startTransactionWithName:operation:bindToScope:")] - SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); + [Export("startTransactionWithName:operation:bindToScope:")] + SentrySpan StartTransactionWithName(string name, string operation, bool bindToScope); // -(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext __attribute__((swift_name("startTransaction(transactionContext:)"))); - [Export ("startTransactionWithContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); + [Export("startTransactionWithContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext); // -(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope __attribute__((swift_name("startTransaction(transactionContext:bindToScope:)"))); - [Export ("startTransactionWithContext:bindToScope:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); + [Export("startTransactionWithContext:bindToScope:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, bool bindToScope); // -(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext __attribute__((swift_name("startTransaction(transactionContext:bindToScope:customSamplingContext:)"))); - [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); + [Export("startTransactionWithContext:bindToScope:customSamplingContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); // -(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext __attribute__((swift_name("startTransaction(transactionContext:customSamplingContext:)"))); - [Export ("startTransactionWithContext:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); + [Export("startTransactionWithContext:customSamplingContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, NSDictionary customSamplingContext); // -(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error __attribute__((swift_name("capture(error:)"))); - [Export ("captureError:")] - SentryId CaptureError (NSError error); + [Export("captureError:")] + SentryId CaptureError(NSError error); // -(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(error:scope:)"))); - [Export ("captureError:withScope:")] - SentryId CaptureError (NSError error, SentryScope scope); + [Export("captureError:withScope:")] + SentryId CaptureError(NSError error, SentryScope scope); // -(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception __attribute__((swift_name("capture(exception:)"))); - [Export ("captureException:")] - SentryId CaptureException (NSException exception); + [Export("captureException:")] + SentryId CaptureException(NSException exception); // -(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(exception:scope:)"))); - [Export ("captureException:withScope:")] - SentryId CaptureException (NSException exception, SentryScope scope); + [Export("captureException:withScope:")] + SentryId CaptureException(NSException exception, SentryScope scope); // -(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message __attribute__((swift_name("capture(message:)"))); - [Export ("captureMessage:")] - SentryId CaptureMessage (string message); + [Export("captureMessage:")] + SentryId CaptureMessage(string message); // -(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(message:scope:)"))); - [Export ("captureMessage:withScope:")] - SentryId CaptureMessage (string message, SentryScope scope); + [Export("captureMessage:withScope:")] + SentryId CaptureMessage(string message, SentryScope scope); // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; - [Export ("captureFeedback:")] - void CaptureFeedback (SentryFeedback feedback); + [Export("captureFeedback:")] + void CaptureFeedback(SentryFeedback feedback); // -(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; - [Export ("configureScope:")] - void ConfigureScope (Action callback); + [Export("configureScope:")] + void ConfigureScope(Action callback); // -(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb; - [Export ("addBreadcrumb:")] - void AddBreadcrumb (SentryBreadcrumb crumb); + [Export("addBreadcrumb:")] + void AddBreadcrumb(SentryBreadcrumb crumb); // -(SentryClient * _Nullable)getClient; - [NullAllowed, Export ("getClient")] + [NullAllowed, Export("getClient")] SentryClient Client { get; } // @property (readonly, nonatomic, strong) SentryScope * _Nonnull scope; - [Export ("scope", ArgumentSemantic.Strong)] + [Export("scope", ArgumentSemantic.Strong)] SentryScope Scope { get; } // -(void)bindClient:(SentryClient * _Nullable)client; - [Export ("bindClient:")] - void BindClient ([NullAllowed] SentryClient client); + [Export("bindClient:")] + void BindClient([NullAllowed] SentryClient client); // -(BOOL)hasIntegration:(NSString * _Nonnull)integrationName; - [Export ("hasIntegration:")] - bool HasIntegration (string integrationName); + [Export("hasIntegration:")] + bool HasIntegration(string integrationName); // -(BOOL)isIntegrationInstalled:(Class _Nonnull)integrationClass; - [Export ("isIntegrationInstalled:")] - bool IsIntegrationInstalled (Class integrationClass); + [Export("isIntegrationInstalled:")] + bool IsIntegrationInstalled(Class integrationClass); // -(void)setUser:(SentryUser * _Nullable)user; - [Export ("setUser:")] - void SetUser ([NullAllowed] SentryUser user); + [Export("setUser:")] + void SetUser([NullAllowed] SentryUser user); // -(void)reportFullyDisplayed; - [Export ("reportFullyDisplayed")] - void ReportFullyDisplayed (); + [Export("reportFullyDisplayed")] + void ReportFullyDisplayed(); // -(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)"))); - [Export ("flush:")] - void Flush (double timeout); + [Export("flush:")] + void Flush(double timeout); // -(void)close; - [Export ("close")] - void Close (); + [Export("close")] + void Close(); } // @interface SentryMeasurementUnit : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMeasurementUnit { +interface SentryMeasurementUnit +{ // -(instancetype _Nonnull)initWithUnit:(NSString * _Nonnull)unit; - [Export ("initWithUnit:")] - NativeHandle Constructor (string unit); + [Export("initWithUnit:")] + NativeHandle Constructor(string unit); // @property (readonly, copy) NSString * _Nonnull unit; - [Export ("unit")] + [Export("unit")] string Unit { get; } // @property (readonly, copy, class) SentryMeasurementUnit * _Nonnull none; [Static] - [Export ("none", ArgumentSemantic.Copy)] + [Export("none", ArgumentSemantic.Copy)] SentryMeasurementUnit None { get; } } // @interface SentryMeasurementUnitDuration : SentryMeasurementUnit -[BaseType (typeof(SentryMeasurementUnit))] +[BaseType(typeof(SentryMeasurementUnit))] [DisableDefaultCtor] [Internal] interface SentryMeasurementUnitDuration { // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull nanosecond; [Static] - [Export ("nanosecond", ArgumentSemantic.Copy)] + [Export("nanosecond", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Nanosecond { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull microsecond; [Static] - [Export ("microsecond", ArgumentSemantic.Copy)] + [Export("microsecond", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Microsecond { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull millisecond; [Static] - [Export ("millisecond", ArgumentSemantic.Copy)] + [Export("millisecond", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Millisecond { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull second; [Static] - [Export ("second", ArgumentSemantic.Copy)] + [Export("second", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Second { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull minute; [Static] - [Export ("minute", ArgumentSemantic.Copy)] + [Export("minute", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Minute { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull hour; [Static] - [Export ("hour", ArgumentSemantic.Copy)] + [Export("hour", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Hour { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull day; [Static] - [Export ("day", ArgumentSemantic.Copy)] + [Export("day", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Day { get; } // @property (readonly, copy, class) SentryMeasurementUnitDuration * _Nonnull week; [Static] - [Export ("week", ArgumentSemantic.Copy)] + [Export("week", ArgumentSemantic.Copy)] SentryMeasurementUnitDuration Week { get; } } // @interface SentryMeasurementUnitInformation : SentryMeasurementUnit -[BaseType (typeof(SentryMeasurementUnit))] +[BaseType(typeof(SentryMeasurementUnit))] [DisableDefaultCtor] [Internal] interface SentryMeasurementUnitInformation { // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull bit; [Static] - [Export ("bit", ArgumentSemantic.Copy)] + [Export("bit", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Bit { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull byte; [Static] - [Export ("byte", ArgumentSemantic.Copy)] + [Export("byte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Byte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull kilobyte; [Static] - [Export ("kilobyte", ArgumentSemantic.Copy)] + [Export("kilobyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Kilobyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull kibibyte; [Static] - [Export ("kibibyte", ArgumentSemantic.Copy)] + [Export("kibibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Kibibyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull megabyte; [Static] - [Export ("megabyte", ArgumentSemantic.Copy)] + [Export("megabyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Megabyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull mebibyte; [Static] - [Export ("mebibyte", ArgumentSemantic.Copy)] + [Export("mebibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Mebibyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull gigabyte; [Static] - [Export ("gigabyte", ArgumentSemantic.Copy)] + [Export("gigabyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Gigabyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull gibibyte; [Static] - [Export ("gibibyte", ArgumentSemantic.Copy)] + [Export("gibibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Gibibyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull terabyte; [Static] - [Export ("terabyte", ArgumentSemantic.Copy)] + [Export("terabyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Terabyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull tebibyte; [Static] - [Export ("tebibyte", ArgumentSemantic.Copy)] + [Export("tebibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Tebibyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull petabyte; [Static] - [Export ("petabyte", ArgumentSemantic.Copy)] + [Export("petabyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Petabyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull pebibyte; [Static] - [Export ("pebibyte", ArgumentSemantic.Copy)] + [Export("pebibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Pebibyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull exabyte; [Static] - [Export ("exabyte", ArgumentSemantic.Copy)] + [Export("exabyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Exabyte { get; } // @property (readonly, copy, class) SentryMeasurementUnitInformation * _Nonnull exbibyte; [Static] - [Export ("exbibyte", ArgumentSemantic.Copy)] + [Export("exbibyte", ArgumentSemantic.Copy)] SentryMeasurementUnitInformation Exbibyte { get; } } // @interface SentryMeasurementUnitFraction : SentryMeasurementUnit -[BaseType (typeof(SentryMeasurementUnit))] +[BaseType(typeof(SentryMeasurementUnit))] [DisableDefaultCtor] [Internal] interface SentryMeasurementUnitFraction { // @property (readonly, copy, class) SentryMeasurementUnitFraction * _Nonnull ratio; [Static] - [Export ("ratio", ArgumentSemantic.Copy)] + [Export("ratio", ArgumentSemantic.Copy)] SentryMeasurementUnitFraction Ratio { get; } // @property (readonly, copy, class) SentryMeasurementUnitFraction * _Nonnull percent; [Static] - [Export ("percent", ArgumentSemantic.Copy)] + [Export("percent", ArgumentSemantic.Copy)] SentryMeasurementUnitFraction Percent { get; } } // @interface SentryMechanism : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryMechanism : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull type; - [Export ("type")] + [Export("type")] string Type { get; set; } // @property (copy, nonatomic) NSString * _Nullable desc; - [NullAllowed, Export ("desc")] + [NullAllowed, Export("desc")] string Desc { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Strong)] + [NullAllowed, Export("data", ArgumentSemantic.Strong)] NSDictionary Data { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable handled; - [NullAllowed, Export ("handled", ArgumentSemantic.Copy)] + [NullAllowed, Export("handled", ArgumentSemantic.Copy)] NSNumber Handled { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable synthetic; - [NullAllowed, Export ("synthetic", ArgumentSemantic.Copy)] + [NullAllowed, Export("synthetic", ArgumentSemantic.Copy)] NSNumber Synthetic { get; set; } // @property (copy, nonatomic) NSString * _Nullable helpLink; - [NullAllowed, Export ("helpLink")] + [NullAllowed, Export("helpLink")] string HelpLink { get; set; } // @property (nonatomic, strong) SentryMechanismMeta * _Nullable meta; - [NullAllowed, Export ("meta", ArgumentSemantic.Strong)] + [NullAllowed, Export("meta", ArgumentSemantic.Strong)] SentryMechanismMeta Meta { get; set; } // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type; - [Export ("initWithType:")] - NativeHandle Constructor (string type); + [Export("initWithType:")] + NativeHandle Constructor(string type); } // @interface SentryMechanismMeta : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryMechanismMeta : ISentrySerializable { // @property (nonatomic, strong) NSDictionary * _Nullable signal; - [NullAllowed, Export ("signal", ArgumentSemantic.Strong)] + [NullAllowed, Export("signal", ArgumentSemantic.Strong)] NSDictionary Signal { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable machException; - [NullAllowed, Export ("machException", ArgumentSemantic.Strong)] + [NullAllowed, Export("machException", ArgumentSemantic.Strong)] NSDictionary MachException { get; set; } // @property (nonatomic, strong) SentryNSError * _Nullable error; - [NullAllowed, Export ("error", ArgumentSemantic.Strong)] + [NullAllowed, Export("error", ArgumentSemantic.Strong)] SentryNSError Error { get; set; } } // @interface SentryMessage : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryMessage : ISentrySerializable { // -(instancetype _Nonnull)initWithFormatted:(NSString * _Nonnull)formatted; - [Export ("initWithFormatted:")] - NativeHandle Constructor (string formatted); + [Export("initWithFormatted:")] + NativeHandle Constructor(string formatted); // @property (readonly, copy, nonatomic) NSString * _Nonnull formatted; - [Export ("formatted")] + [Export("formatted")] string Formatted { get; } // @property (copy, nonatomic) NSString * _Nullable message; - [NullAllowed, Export ("message")] + [NullAllowed, Export("message")] string Message { get; set; } // @property (nonatomic, strong) NSArray * _Nullable params; - [NullAllowed, Export ("params", ArgumentSemantic.Strong)] + [NullAllowed, Export("params", ArgumentSemantic.Strong)] string[] Params { get; set; } } // @interface SentryNSError : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryNSError : ISentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull domain; - [Export ("domain")] + [Export("domain")] string Domain { get; set; } // @property (assign, nonatomic) NSInteger code; - [Export ("code")] + [Export("code")] nint Code { get; set; } // -(instancetype _Nonnull)initWithDomain:(NSString * _Nonnull)domain code:(NSInteger)code; - [Export ("initWithDomain:code:")] - NativeHandle Constructor (string domain, nint code); + [Export("initWithDomain:code:")] + NativeHandle Constructor(string domain, nint code); } // @interface SentryOptions : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryOptions { // @property (nonatomic, strong) NSString * _Nullable dsn; - [NullAllowed, Export ("dsn", ArgumentSemantic.Strong)] + [NullAllowed, Export("dsn", ArgumentSemantic.Strong)] string Dsn { get; set; } // @property (nonatomic, strong) SentryDsn * _Nullable parsedDsn; - [NullAllowed, Export ("parsedDsn", ArgumentSemantic.Strong)] + [NullAllowed, Export("parsedDsn", ArgumentSemantic.Strong)] SentryDsn ParsedDsn { get; set; } // @property (assign, nonatomic) BOOL debug; - [Export ("debug")] + [Export("debug")] bool Debug { get; set; } // @property (assign, nonatomic) SentryLevel diagnosticLevel; - [Export ("diagnosticLevel", ArgumentSemantic.Assign)] + [Export("diagnosticLevel", ArgumentSemantic.Assign)] SentryLevel DiagnosticLevel { get; set; } // @property (copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] + [NullAllowed, Export("releaseName")] string ReleaseName { get; set; } // @property (copy, nonatomic) NSString * _Nullable dist; - [NullAllowed, Export ("dist")] + [NullAllowed, Export("dist")] string Dist { get; set; } // @property (copy, nonatomic) NSString * _Nonnull environment; - [Export ("environment")] + [Export("environment")] string Environment { get; set; } // @property (assign, nonatomic) BOOL enabled; - [Export ("enabled")] + [Export("enabled")] bool Enabled { get; set; } // @property (assign, nonatomic) NSTimeInterval shutdownTimeInterval; - [Export ("shutdownTimeInterval")] + [Export("shutdownTimeInterval")] double ShutdownTimeInterval { get; set; } // @property (assign, nonatomic) BOOL enableCrashHandler; - [Export ("enableCrashHandler")] + [Export("enableCrashHandler")] bool EnableCrashHandler { get; set; } // @property (assign, nonatomic) BOOL enableSigtermReporting; - [Export ("enableSigtermReporting")] + [Export("enableSigtermReporting")] bool EnableSigtermReporting { get; set; } // @property (assign, nonatomic) NSUInteger maxBreadcrumbs; - [Export ("maxBreadcrumbs")] + [Export("maxBreadcrumbs")] nuint MaxBreadcrumbs { get; set; } // @property (assign, nonatomic) BOOL enableNetworkBreadcrumbs; - [Export ("enableNetworkBreadcrumbs")] + [Export("enableNetworkBreadcrumbs")] bool EnableNetworkBreadcrumbs { get; set; } // @property (assign, nonatomic) NSUInteger maxCacheItems; - [Export ("maxCacheItems")] + [Export("maxCacheItems")] nuint MaxCacheItems { get; set; } // @property (copy, nonatomic) SentryBeforeSendEventCallback _Nullable beforeSend; - [NullAllowed, Export ("beforeSend", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeSend", ArgumentSemantic.Copy)] SentryBeforeSendEventCallback BeforeSend { get; set; } // @property (copy, nonatomic) SentryBeforeSendSpanCallback _Nullable beforeSendSpan; - [NullAllowed, Export ("beforeSendSpan", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeSendSpan", ArgumentSemantic.Copy)] SentryBeforeSendSpanCallback BeforeSendSpan { get; set; } // @property (copy, nonatomic) SentryBeforeSendLogCallback _Nullable beforeSendLog; - [NullAllowed, Export ("beforeSendLog", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeSendLog", ArgumentSemantic.Copy)] SentryBeforeSendLogCallback BeforeSendLog { get; set; } // @property (copy, nonatomic) SentryBeforeBreadcrumbCallback _Nullable beforeBreadcrumb; - [NullAllowed, Export ("beforeBreadcrumb", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeBreadcrumb", ArgumentSemantic.Copy)] SentryBeforeBreadcrumbCallback BeforeBreadcrumb { get; set; } // @property (copy, nonatomic) SentryBeforeCaptureScreenshotCallback _Nullable beforeCaptureScreenshot; - [NullAllowed, Export ("beforeCaptureScreenshot", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeCaptureScreenshot", ArgumentSemantic.Copy)] SentryBeforeCaptureScreenshotCallback BeforeCaptureScreenshot { get; set; } // @property (copy, nonatomic) SentryBeforeCaptureScreenshotCallback _Nullable beforeCaptureViewHierarchy; - [NullAllowed, Export ("beforeCaptureViewHierarchy", ArgumentSemantic.Copy)] + [NullAllowed, Export("beforeCaptureViewHierarchy", ArgumentSemantic.Copy)] SentryBeforeCaptureScreenshotCallback BeforeCaptureViewHierarchy { get; set; } // @property (copy, nonatomic) SentryOnCrashedLastRunCallback _Nullable onCrashedLastRun; - [NullAllowed, Export ("onCrashedLastRun", ArgumentSemantic.Copy)] + [NullAllowed, Export("onCrashedLastRun", ArgumentSemantic.Copy)] SentryOnCrashedLastRunCallback OnCrashedLastRun { get; set; } // @property (copy, nonatomic) DEPRECATED_MSG_ATTRIBUTE("Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or disabled using their respective `SentryOptions.enable*` property.") NSArray * integrations __attribute__((deprecated("Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or disabled using their respective `SentryOptions.enable*` property."))); - [Export ("integrations", ArgumentSemantic.Copy)] + [Export("integrations", ArgumentSemantic.Copy)] string[] Integrations { get; set; } // +(NSArray * _Nonnull)defaultIntegrations; [Static] - [Export ("defaultIntegrations")] + [Export("defaultIntegrations")] string[] DefaultIntegrations { get; } // @property (copy, nonatomic) NSNumber * _Nullable sampleRate; - [NullAllowed, Export ("sampleRate", ArgumentSemantic.Copy)] + [NullAllowed, Export("sampleRate", ArgumentSemantic.Copy)] NSNumber SampleRate { get; set; } // @property (assign, nonatomic) BOOL enableAutoSessionTracking; - [Export ("enableAutoSessionTracking")] + [Export("enableAutoSessionTracking")] bool EnableAutoSessionTracking { get; set; } // @property (assign, nonatomic) BOOL enableGraphQLOperationTracking; - [Export ("enableGraphQLOperationTracking")] + [Export("enableGraphQLOperationTracking")] bool EnableGraphQLOperationTracking { get; set; } // @property (assign, nonatomic) BOOL enableWatchdogTerminationTracking; - [Export ("enableWatchdogTerminationTracking")] + [Export("enableWatchdogTerminationTracking")] bool EnableWatchdogTerminationTracking { get; set; } // @property (assign, nonatomic) NSUInteger sessionTrackingIntervalMillis; - [Export ("sessionTrackingIntervalMillis")] + [Export("sessionTrackingIntervalMillis")] nuint SessionTrackingIntervalMillis { get; set; } // @property (assign, nonatomic) BOOL attachStacktrace; - [Export ("attachStacktrace")] + [Export("attachStacktrace")] bool AttachStacktrace { get; set; } // @property (assign, nonatomic) NSUInteger maxAttachmentSize; - [Export ("maxAttachmentSize")] + [Export("maxAttachmentSize")] nuint MaxAttachmentSize { get; set; } // @property (assign, nonatomic) BOOL sendDefaultPii; - [Export ("sendDefaultPii")] + [Export("sendDefaultPii")] bool SendDefaultPii { get; set; } // @property (assign, nonatomic) BOOL enableAutoPerformanceTracing; - [Export ("enableAutoPerformanceTracing")] + [Export("enableAutoPerformanceTracing")] bool EnableAutoPerformanceTracing { get; set; } // @property (assign, nonatomic) BOOL enablePerformanceV2; - [Export ("enablePerformanceV2")] + [Export("enablePerformanceV2")] bool EnablePerformanceV2 { get; set; } // @property (assign, nonatomic) BOOL enablePersistingTracesWhenCrashing; - [Export ("enablePersistingTracesWhenCrashing")] + [Export("enablePersistingTracesWhenCrashing")] bool EnablePersistingTracesWhenCrashing { get; set; } // @property (nonatomic) SentryScope * _Nonnull (^ _Nonnull)(SentryScope * _Nonnull) initialScope; - [Export ("initialScope", ArgumentSemantic.Assign)] + [Export("initialScope", ArgumentSemantic.Assign)] Func InitialScope { get; set; } // @property (assign, nonatomic) BOOL enableUIViewControllerTracing; - [Export ("enableUIViewControllerTracing")] + [Export("enableUIViewControllerTracing")] bool EnableUIViewControllerTracing { get; set; } // @property (assign, nonatomic) BOOL attachScreenshot; - [Export ("attachScreenshot")] + [Export("attachScreenshot")] bool AttachScreenshot { get; set; } // @property (nonatomic, strong) SentryViewScreenshotOptions * _Nonnull screenshot; - [Export ("screenshot", ArgumentSemantic.Strong)] + [Export("screenshot", ArgumentSemantic.Strong)] SentryViewScreenshotOptions Screenshot { get; set; } // @property (assign, nonatomic) BOOL attachViewHierarchy; - [Export ("attachViewHierarchy")] + [Export("attachViewHierarchy")] bool AttachViewHierarchy { get; set; } // @property (assign, nonatomic) BOOL reportAccessibilityIdentifier; - [Export ("reportAccessibilityIdentifier")] + [Export("reportAccessibilityIdentifier")] bool ReportAccessibilityIdentifier { get; set; } // @property (assign, nonatomic) BOOL enableUserInteractionTracing; - [Export ("enableUserInteractionTracing")] + [Export("enableUserInteractionTracing")] bool EnableUserInteractionTracing { get; set; } // @property (assign, nonatomic) NSTimeInterval idleTimeout; - [Export ("idleTimeout")] + [Export("idleTimeout")] double IdleTimeout { get; set; } // @property (assign, nonatomic) BOOL enablePreWarmedAppStartTracing; - [Export ("enablePreWarmedAppStartTracing")] + [Export("enablePreWarmedAppStartTracing")] bool EnablePreWarmedAppStartTracing { get; set; } // @property (nonatomic, strong) SentryReplayOptions * _Nonnull sessionReplay; - [Export ("sessionReplay", ArgumentSemantic.Strong)] + [Export("sessionReplay", ArgumentSemantic.Strong)] SentryReplayOptions SessionReplay { get; set; } // @property (assign, nonatomic) BOOL enableNetworkTracking; - [Export ("enableNetworkTracking")] + [Export("enableNetworkTracking")] bool EnableNetworkTracking { get; set; } // @property (assign, nonatomic) BOOL enableFileIOTracing; - [Export ("enableFileIOTracing")] + [Export("enableFileIOTracing")] bool EnableFileIOTracing { get; set; } // @property (nonatomic) BOOL enableTracing __attribute__((deprecated("Use tracesSampleRate or tracesSampler instead"))); - [Export ("enableTracing")] + [Export("enableTracing")] bool EnableTracing { get; set; } // @property (nonatomic, strong) NSNumber * _Nullable tracesSampleRate; - [NullAllowed, Export ("tracesSampleRate", ArgumentSemantic.Strong)] + [NullAllowed, Export("tracesSampleRate", ArgumentSemantic.Strong)] NSNumber TracesSampleRate { get; set; } // @property (nonatomic) SentryTracesSamplerCallback _Nullable tracesSampler; - [NullAllowed, Export ("tracesSampler", ArgumentSemantic.Assign)] + [NullAllowed, Export("tracesSampler", ArgumentSemantic.Assign)] SentryTracesSamplerCallback TracesSampler { get; set; } // @property (readonly, assign, nonatomic) BOOL isTracingEnabled; - [Export ("isTracingEnabled")] + [Export("isTracingEnabled")] bool IsTracingEnabled { get; } // @property (readonly, copy, nonatomic) NSArray * _Nonnull inAppIncludes; - [Export ("inAppIncludes", ArgumentSemantic.Copy)] + [Export("inAppIncludes", ArgumentSemantic.Copy)] string[] InAppIncludes { get; } // -(void)addInAppInclude:(NSString * _Nonnull)inAppInclude; - [Export ("addInAppInclude:")] - void AddInAppInclude (string inAppInclude); + [Export("addInAppInclude:")] + void AddInAppInclude(string inAppInclude); // @property (readonly, copy, nonatomic) NSArray * _Nonnull inAppExcludes; - [Export ("inAppExcludes", ArgumentSemantic.Copy)] + [Export("inAppExcludes", ArgumentSemantic.Copy)] string[] InAppExcludes { get; } // -(void)addInAppExclude:(NSString * _Nonnull)inAppExclude; - [Export ("addInAppExclude:")] - void AddInAppExclude (string inAppExclude); + [Export("addInAppExclude:")] + void AddInAppExclude(string inAppExclude); - [Wrap ("WeakUrlSessionDelegate")] + [Wrap("WeakUrlSessionDelegate")] [NullAllowed] NSUrlSessionDelegate UrlSessionDelegate { get; set; } // @property (nonatomic, weak) id _Nullable urlSessionDelegate; - [NullAllowed, Export ("urlSessionDelegate", ArgumentSemantic.Weak)] + [NullAllowed, Export("urlSessionDelegate", ArgumentSemantic.Weak)] NSObject WeakUrlSessionDelegate { get; set; } // @property (nonatomic, strong) NSURLSession * _Nullable urlSession; - [NullAllowed, Export ("urlSession", ArgumentSemantic.Strong)] + [NullAllowed, Export("urlSession", ArgumentSemantic.Strong)] NSUrlSession UrlSession { get; set; } // @property (assign, nonatomic) BOOL enableSwizzling; - [Export ("enableSwizzling")] + [Export("enableSwizzling")] bool EnableSwizzling { get; set; } // @property (nonatomic, strong) NSSet * _Nonnull swizzleClassNameExcludes; - [Export ("swizzleClassNameExcludes", ArgumentSemantic.Strong)] + [Export("swizzleClassNameExcludes", ArgumentSemantic.Strong)] NSSet SwizzleClassNameExcludes { get; set; } // @property (assign, nonatomic) BOOL enableCoreDataTracing; - [Export ("enableCoreDataTracing")] + [Export("enableCoreDataTracing")] bool EnableCoreDataTracing { get; set; } // @property (copy, nonatomic) SentryProfilingConfigurationBlock _Nullable configureProfiling; - [NullAllowed, Export ("configureProfiling", ArgumentSemantic.Copy)] + [NullAllowed, Export("configureProfiling", ArgumentSemantic.Copy)] SentryProfilingConfigurationBlock ConfigureProfiling { get; set; } // @property (assign, nonatomic) BOOL enableAppLaunchProfiling __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.startOnAppStart and SentryProfileOptions.lifecycle"))); - [Export ("enableAppLaunchProfiling")] + [Export("enableAppLaunchProfiling")] bool EnableAppLaunchProfiling { get; set; } // @property (nonatomic, strong) DEPRECATED_MSG_ATTRIBUTE("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate") NSNumber * profilesSampleRate __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate"))); - [Export ("profilesSampleRate", ArgumentSemantic.Strong)] + [Export("profilesSampleRate", ArgumentSemantic.Strong)] NSNumber ProfilesSampleRate { get; set; } // @property (nonatomic) DEPRECATED_MSG_ATTRIBUTE("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate") SentryTracesSamplerCallback profilesSampler __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate"))); - [Export ("profilesSampler", ArgumentSemantic.Assign)] + [Export("profilesSampler", ArgumentSemantic.Assign)] SentryTracesSamplerCallback ProfilesSampler { get; set; } // @property (readonly, assign, nonatomic) BOOL isProfilingEnabled __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK"))); - [Export ("isProfilingEnabled")] + [Export("isProfilingEnabled")] bool IsProfilingEnabled { get; } // @property (assign, nonatomic) BOOL enableProfiling __attribute__((deprecated("Use profilesSampleRate or profilesSampler instead. This property will be removed in a future version of the SDK"))); - [Export ("enableProfiling")] + [Export("enableProfiling")] bool EnableProfiling { get; set; } // @property (assign, nonatomic) BOOL sendClientReports; - [Export ("sendClientReports")] + [Export("sendClientReports")] bool SendClientReports { get; set; } // @property (assign, nonatomic) BOOL enableAppHangTracking; - [Export ("enableAppHangTracking")] + [Export("enableAppHangTracking")] bool EnableAppHangTracking { get; set; } // @property (assign, nonatomic) BOOL enableAppHangTrackingV2; - [Export ("enableAppHangTrackingV2")] + [Export("enableAppHangTrackingV2")] bool EnableAppHangTrackingV2 { get; set; } // @property (assign, nonatomic) BOOL enableReportNonFullyBlockingAppHangs; - [Export ("enableReportNonFullyBlockingAppHangs")] + [Export("enableReportNonFullyBlockingAppHangs")] bool EnableReportNonFullyBlockingAppHangs { get; set; } // @property (assign, nonatomic) NSTimeInterval appHangTimeoutInterval; - [Export ("appHangTimeoutInterval")] + [Export("appHangTimeoutInterval")] double AppHangTimeoutInterval { get; set; } // @property (assign, nonatomic) BOOL enableAutoBreadcrumbTracking; - [Export ("enableAutoBreadcrumbTracking")] + [Export("enableAutoBreadcrumbTracking")] bool EnableAutoBreadcrumbTracking { get; set; } // @property (retain, nonatomic) NSArray * _Nonnull tracePropagationTargets; - [Export ("tracePropagationTargets", ArgumentSemantic.Retain)] NSObject[] TracePropagationTargets { get; set; } + [Export("tracePropagationTargets", ArgumentSemantic.Retain)] NSObject[] TracePropagationTargets { get; set; } // @property (assign, nonatomic) BOOL enableCaptureFailedRequests; - [Export ("enableCaptureFailedRequests")] + [Export("enableCaptureFailedRequests")] bool EnableCaptureFailedRequests { get; set; } // @property (nonatomic, strong) NSArray * _Nonnull failedRequestStatusCodes; - [Export ("failedRequestStatusCodes", ArgumentSemantic.Strong)] + [Export("failedRequestStatusCodes", ArgumentSemantic.Strong)] SentryHttpStatusCodeRange[] FailedRequestStatusCodes { get; set; } // @property (nonatomic, strong) NSArray * _Nonnull failedRequestTargets; - [Export ("failedRequestTargets", ArgumentSemantic.Strong)] NSObject[] FailedRequestTargets { get; set; } + [Export("failedRequestTargets", ArgumentSemantic.Strong)] NSObject[] FailedRequestTargets { get; set; } // @property (assign, nonatomic) BOOL enableMetricKit __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); - [NoWatch, NoTV, MacCatalyst (15, 0)] - [Export ("enableMetricKit")] + [NoWatch, NoTV, MacCatalyst(15, 0)] + [Export("enableMetricKit")] bool EnableMetricKit { get; set; } // @property (assign, nonatomic) BOOL enableMetricKitRawPayload __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); - [NoWatch, NoTV, MacCatalyst (15, 0)] - [Export ("enableMetricKitRawPayload")] + [NoWatch, NoTV, MacCatalyst(15, 0)] + [Export("enableMetricKitRawPayload")] bool EnableMetricKitRawPayload { get; set; } // @property (nonatomic) BOOL enableTimeToFullDisplayTracing; - [Export ("enableTimeToFullDisplayTracing")] + [Export("enableTimeToFullDisplayTracing")] bool EnableTimeToFullDisplayTracing { get; set; } // @property (assign, nonatomic) BOOL swiftAsyncStacktraces; - [Export ("swiftAsyncStacktraces")] + [Export("swiftAsyncStacktraces")] bool SwiftAsyncStacktraces { get; set; } // @property (copy, nonatomic) NSString * _Nonnull cacheDirectoryPath; - [Export ("cacheDirectoryPath")] + [Export("cacheDirectoryPath")] string CacheDirectoryPath { get; set; } // @property (assign, nonatomic) BOOL enableSpotlight; - [Export ("enableSpotlight")] + [Export("enableSpotlight")] bool EnableSpotlight { get; set; } // @property (copy, nonatomic) NSString * _Nonnull spotlightUrl; - [Export ("spotlightUrl")] + [Export("spotlightUrl")] string SpotlightUrl { get; set; } // @property (readonly, nonatomic) NSObject * _Nonnull _swiftExperimentalOptions; - [Export ("_swiftExperimentalOptions")] + [Export("_swiftExperimentalOptions")] NSObject _swiftExperimentalOptions { get; } } // typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions * _Nonnull); [Internal] -delegate void SentryProfilingConfigurationBlock (SentryProfileOptions options); +delegate void SentryProfilingConfigurationBlock(SentryProfileOptions options); // @interface SentryReplayApi : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryReplayApi { // -(void)maskView:(UIView * _Nonnull)view __attribute__((swift_name("maskView(_:)"))); - [Export ("maskView:")] - void MaskView (UIView view); + [Export("maskView:")] + void MaskView(UIView view); // -(void)unmaskView:(UIView * _Nonnull)view __attribute__((swift_name("unmaskView(_:)"))); - [Export ("unmaskView:")] - void UnmaskView (UIView view); + [Export("unmaskView:")] + void UnmaskView(UIView view); // -(void)pause; - [Export ("pause")] - void Pause (); + [Export("pause")] + void Pause(); // -(void)resume; - [Export ("resume")] - void Resume (); + [Export("resume")] + void Resume(); // -(void)start; - [Export ("start")] - void Start (); + [Export("start")] + void Start(); // -(void)stop; - [Export ("stop")] - void Stop (); + [Export("stop")] + void Stop(); // -(void)showMaskPreview; - [Export ("showMaskPreview")] - void ShowMaskPreview (); + [Export("showMaskPreview")] + void ShowMaskPreview(); // -(void)showMaskPreview:(CGFloat)opacity; - [Export ("showMaskPreview:")] - void ShowMaskPreview (nfloat opacity); + [Export("showMaskPreview:")] + void ShowMaskPreview(nfloat opacity); // -(void)hideMaskPreview; - [Export ("hideMaskPreview")] - void HideMaskPreview (); + [Export("hideMaskPreview")] + void HideMaskPreview(); } // @interface SentryRequest : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryRequest : ISentrySerializable { // @property (copy, nonatomic) NSNumber * _Nullable bodySize; - [NullAllowed, Export ("bodySize", ArgumentSemantic.Copy)] + [NullAllowed, Export("bodySize", ArgumentSemantic.Copy)] NSNumber BodySize { get; set; } // @property (copy, nonatomic) NSString * _Nullable cookies; - [NullAllowed, Export ("cookies")] + [NullAllowed, Export("cookies")] string Cookies { get; set; } // @property (nonatomic, strong) NSDictionary * _Nullable headers; - [NullAllowed, Export ("headers", ArgumentSemantic.Strong)] + [NullAllowed, Export("headers", ArgumentSemantic.Strong)] NSDictionary Headers { get; set; } // @property (copy, nonatomic) NSString * _Nullable fragment; - [NullAllowed, Export ("fragment")] + [NullAllowed, Export("fragment")] string Fragment { get; set; } // @property (copy, nonatomic) NSString * _Nullable method; - [NullAllowed, Export ("method")] + [NullAllowed, Export("method")] string Method { get; set; } // @property (copy, nonatomic) NSString * _Nullable queryString; - [NullAllowed, Export ("queryString")] + [NullAllowed, Export("queryString")] string QueryString { get; set; } // @property (copy, nonatomic) NSString * _Nullable url; - [NullAllowed, Export ("url")] + [NullAllowed, Export("url")] string Url { get; set; } } // @interface SentrySamplingContext : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentrySamplingContext { // @property (readonly, nonatomic) SentryTransactionContext * _Nonnull transactionContext; - [Export ("transactionContext")] + [Export("transactionContext")] SentryTransactionContext TransactionContext { get; } // @property (readonly, nonatomic) NSDictionary * _Nullable customSamplingContext; - [NullAllowed, Export ("customSamplingContext")] + [NullAllowed, Export("customSamplingContext")] NSDictionary CustomSamplingContext { get; } // -(instancetype _Nonnull)initWithTransactionContext:(SentryTransactionContext * _Nonnull)transactionContext; - [Export ("initWithTransactionContext:")] - NativeHandle Constructor (SentryTransactionContext transactionContext); + [Export("initWithTransactionContext:")] + NativeHandle Constructor(SentryTransactionContext transactionContext); // -(instancetype _Nonnull)initWithTransactionContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; - [Export ("initWithTransactionContext:customSamplingContext:")] - NativeHandle Constructor (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); + [Export("initWithTransactionContext:customSamplingContext:")] + NativeHandle Constructor(SentryTransactionContext transactionContext, NSDictionary customSamplingContext); } // @interface SentryScope : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] partial interface SentryScope : ISentrySerializable { // @property (nonatomic, strong) id _Nullable span; - [NullAllowed, Export ("span", ArgumentSemantic.Strong)] + [NullAllowed, Export("span", ArgumentSemantic.Strong)] SentrySpan Span { get; set; } // @property (nonatomic, strong) NSString * _Nullable replayId; - [NullAllowed, Export ("replayId", ArgumentSemantic.Strong)] + [NullAllowed, Export("replayId", ArgumentSemantic.Strong)] string ReplayId { get; set; } // @property (readonly, copy, nonatomic) NSDictionary * _Nonnull tags; - [Export ("tags", ArgumentSemantic.Copy)] + [Export("tags", ArgumentSemantic.Copy)] NSDictionary Tags { get; } // -(instancetype _Nonnull)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs __attribute__((objc_designated_initializer)); - [Export ("initWithMaxBreadcrumbs:")] + [Export("initWithMaxBreadcrumbs:")] [DesignatedInitializer] - NativeHandle Constructor (nint maxBreadcrumbs); + NativeHandle Constructor(nint maxBreadcrumbs); // -(instancetype _Nonnull)initWithScope:(SentryScope * _Nonnull)scope; - [Export ("initWithScope:")] - NativeHandle Constructor (SentryScope scope); + [Export("initWithScope:")] + NativeHandle Constructor(SentryScope scope); // -(void)setUser:(SentryUser * _Nullable)user; - [Export ("setUser:")] - void SetUser ([NullAllowed] SentryUser user); + [Export("setUser:")] + void SetUser([NullAllowed] SentryUser user); // -(void)setTagValue:(NSString * _Nonnull)value forKey:(NSString * _Nonnull)key __attribute__((swift_name("setTag(value:key:)"))); - [Export ("setTagValue:forKey:")] - void SetTagValue (string value, string key); + [Export("setTagValue:forKey:")] + void SetTagValue(string value, string key); // -(void)removeTagForKey:(NSString * _Nonnull)key __attribute__((swift_name("removeTag(key:)"))); - [Export ("removeTagForKey:")] - void RemoveTagForKey (string key); + [Export("removeTagForKey:")] + void RemoveTagForKey(string key); // -(void)setTags:(NSDictionary * _Nullable)tags; - [Export ("setTags:")] - void SetTags ([NullAllowed] NSDictionary tags); + [Export("setTags:")] + void SetTags([NullAllowed] NSDictionary tags); // -(void)setExtras:(NSDictionary * _Nullable)extras; - [Export ("setExtras:")] - void SetExtras ([NullAllowed] NSDictionary extras); + [Export("setExtras:")] + void SetExtras([NullAllowed] NSDictionary extras); // -(void)setExtraValue:(id _Nullable)value forKey:(NSString * _Nonnull)key __attribute__((swift_name("setExtra(value:key:)"))); - [Export ("setExtraValue:forKey:")] - void SetExtraValue ([NullAllowed] NSObject value, string key); + [Export("setExtraValue:forKey:")] + void SetExtraValue([NullAllowed] NSObject value, string key); // -(void)removeExtraForKey:(NSString * _Nonnull)key __attribute__((swift_name("removeExtra(key:)"))); - [Export ("removeExtraForKey:")] - void RemoveExtraForKey (string key); + [Export("removeExtraForKey:")] + void RemoveExtraForKey(string key); // -(void)setDist:(NSString * _Nullable)dist; - [Export ("setDist:")] - void SetDist ([NullAllowed] string dist); + [Export("setDist:")] + void SetDist([NullAllowed] string dist); // -(void)setEnvironment:(NSString * _Nullable)environment; - [Export ("setEnvironment:")] - void SetEnvironment ([NullAllowed] string environment); + [Export("setEnvironment:")] + void SetEnvironment([NullAllowed] string environment); // -(void)setFingerprint:(NSArray * _Nullable)fingerprint; - [Export ("setFingerprint:")] - void SetFingerprint ([NullAllowed] string[] fingerprint); + [Export("setFingerprint:")] + void SetFingerprint([NullAllowed] string[] fingerprint); // -(void)setLevel:(enum SentryLevel)level; - [Export ("setLevel:")] - void SetLevel (SentryLevel level); + [Export("setLevel:")] + void SetLevel(SentryLevel level); // -(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb __attribute__((swift_name("addBreadcrumb(_:)"))); - [Export ("addBreadcrumb:")] - void AddBreadcrumb (SentryBreadcrumb crumb); + [Export("addBreadcrumb:")] + void AddBreadcrumb(SentryBreadcrumb crumb); // -(void)add:(SentryBreadcrumb * _Nonnull)crumb __attribute__((deprecated("use `addBreadcrumb` instead"))) __attribute__((swift_name("add(_:)"))); - [Export ("add:")] - void Add (SentryBreadcrumb crumb); + [Export("add:")] + void Add(SentryBreadcrumb crumb); // -(void)clearBreadcrumbs; - [Export ("clearBreadcrumbs")] - void ClearBreadcrumbs (); + [Export("clearBreadcrumbs")] + void ClearBreadcrumbs(); // -(NSDictionary * _Nonnull)serialize; - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); // -(void)setContextValue:(NSDictionary * _Nonnull)value forKey:(NSString * _Nonnull)key __attribute__((swift_name("setContext(value:key:)"))); - [Export ("setContextValue:forKey:")] - void SetContextValue (NSDictionary value, string key); + [Export("setContextValue:forKey:")] + void SetContextValue(NSDictionary value, string key); // -(void)removeContextForKey:(NSString * _Nonnull)key __attribute__((swift_name("removeContext(key:)"))); - [Export ("removeContextForKey:")] - void RemoveContextForKey (string key); + [Export("removeContextForKey:")] + void RemoveContextForKey(string key); // -(void)addAttachment:(SentryAttachment * _Nonnull)attachment __attribute__((swift_name("addAttachment(_:)"))); - [Export ("addAttachment:")] - void AddAttachment (SentryAttachment attachment); + [Export("addAttachment:")] + void AddAttachment(SentryAttachment attachment); // -(void)includeAttachment:(SentryAttachment * _Nonnull)attachment __attribute__((deprecated("use `addAttachment` instead"))) __attribute__((swift_name("add(_:)"))); - [Export ("includeAttachment:")] - void IncludeAttachment (SentryAttachment attachment); + [Export("includeAttachment:")] + void IncludeAttachment(SentryAttachment attachment); // -(void)clearAttachments; - [Export ("clearAttachments")] - void ClearAttachments (); + [Export("clearAttachments")] + void ClearAttachments(); // -(void)clear; - [Export ("clear")] - void Clear (); + [Export("clear")] + void Clear(); // -(void)useSpan:(SentrySpanCallback _Nonnull)callback __attribute__((deprecated("This method was used to create an atomic block that could be used to mutate the current span. It is not atomic anymore and due to issues with memory safety in `NSBlock` it is now considered unsafe and deprecated. Use `span` instead."))); - [Export ("useSpan:")] - void UseSpan (SentrySpanCallback callback); + [Export("useSpan:")] + void UseSpan(SentrySpanCallback callback); } // @interface SentrySpanId : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] -interface SentrySpanId { +interface SentrySpanId +{ // -(instancetype _Nonnull)initWithUUID:(NSUUID * _Nonnull)uuid; - [Export ("initWithUUID:")] - NativeHandle Constructor (NSUuid uuid); + [Export("initWithUUID:")] + NativeHandle Constructor(NSUuid uuid); // -(instancetype _Nonnull)initWithValue:(NSString * _Nonnull)value; - [Export ("initWithValue:")] - NativeHandle Constructor (string value); + [Export("initWithValue:")] + NativeHandle Constructor(string value); // @property (readonly, copy) NSString * _Nonnull sentrySpanIdString; - [Export ("sentrySpanIdString")] + [Export("sentrySpanIdString")] string SentrySpanIdString { get; } // @property (readonly, nonatomic, strong, class) SentrySpanId * _Nonnull empty; [Static] - [Export ("empty", ArgumentSemantic.Strong)] + [Export("empty", ArgumentSemantic.Strong)] SentrySpanId Empty { get; } } // @interface SentryStacktrace : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryStacktrace : ISentrySerializable { // @property (nonatomic, strong) NSArray * _Nonnull frames; - [Export ("frames", ArgumentSemantic.Strong)] + [Export("frames", ArgumentSemantic.Strong)] SentryFrame[] Frames { get; set; } // @property (nonatomic, strong) NSDictionary * _Nonnull registers; - [Export ("registers", ArgumentSemantic.Strong)] + [Export("registers", ArgumentSemantic.Strong)] NSDictionary Registers { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable snapshot; - [NullAllowed, Export ("snapshot", ArgumentSemantic.Copy)] + [NullAllowed, Export("snapshot", ArgumentSemantic.Copy)] NSNumber Snapshot { get; set; } // -(instancetype _Nonnull)initWithFrames:(NSArray * _Nonnull)frames registers:(NSDictionary * _Nonnull)registers; - [Export ("initWithFrames:registers:")] - NativeHandle Constructor (SentryFrame[] frames, NSDictionary registers); + [Export("initWithFrames:registers:")] + NativeHandle Constructor(SentryFrame[] frames, NSDictionary registers); // -(void)fixDuplicateFrames; - [Export ("fixDuplicateFrames")] - void FixDuplicateFrames (); + [Export("fixDuplicateFrames")] + void FixDuplicateFrames(); } // @interface SentryThread : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryThread : ISentrySerializable { // @property (copy, nonatomic) NSNumber * _Nonnull threadId; - [Export ("threadId", ArgumentSemantic.Copy)] + [Export("threadId", ArgumentSemantic.Copy)] NSNumber ThreadId { get; set; } // @property (copy, nonatomic) NSString * _Nullable name; - [NullAllowed, Export ("name")] + [NullAllowed, Export("name")] string Name { get; set; } // @property (nonatomic, strong) SentryStacktrace * _Nullable stacktrace; - [NullAllowed, Export ("stacktrace", ArgumentSemantic.Strong)] + [NullAllowed, Export("stacktrace", ArgumentSemantic.Strong)] SentryStacktrace Stacktrace { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable crashed; - [NullAllowed, Export ("crashed", ArgumentSemantic.Copy)] + [NullAllowed, Export("crashed", ArgumentSemantic.Copy)] NSNumber Crashed { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable current; - [NullAllowed, Export ("current", ArgumentSemantic.Copy)] + [NullAllowed, Export("current", ArgumentSemantic.Copy)] NSNumber Current { get; set; } // @property (copy, nonatomic) NSNumber * _Nullable isMain; - [NullAllowed, Export ("isMain", ArgumentSemantic.Copy)] + [NullAllowed, Export("isMain", ArgumentSemantic.Copy)] NSNumber IsMain { get; set; } // -(instancetype _Nonnull)initWithThreadId:(NSNumber * _Nonnull)threadId; - [Export ("initWithThreadId:")] - NativeHandle Constructor (NSNumber threadId); + [Export("initWithThreadId:")] + NativeHandle Constructor(NSNumber threadId); } // @interface SentryTraceContext : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface SentryTraceContext : ISentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; - [Export ("traceId")] + [Export("traceId")] SentryId TraceId { get; } // @property (readonly, nonatomic) NSString * _Nonnull publicKey; - [Export ("publicKey")] + [Export("publicKey")] string PublicKey { get; } // @property (readonly, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] + [NullAllowed, Export("releaseName")] string ReleaseName { get; } // @property (readonly, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] + [NullAllowed, Export("environment")] string Environment { get; } // @property (readonly, nonatomic) NSString * _Nullable transaction; - [NullAllowed, Export ("transaction")] + [NullAllowed, Export("transaction")] string Transaction { get; } // @property (readonly, nonatomic) NSString * _Nullable userSegment; - [NullAllowed, Export ("userSegment")] + [NullAllowed, Export("userSegment")] string UserSegment { get; } // @property (readonly, nonatomic) NSString * _Nullable sampleRate; - [NullAllowed, Export ("sampleRate")] + [NullAllowed, Export("sampleRate")] string SampleRate { get; } // @property (readonly, nonatomic) NSString * _Nullable sampleRand; - [NullAllowed, Export ("sampleRand")] + [NullAllowed, Export("sampleRand")] string SampleRand { get; } // @property (readonly, nonatomic) NSString * _Nullable sampled; - [NullAllowed, Export ("sampled")] + [NullAllowed, Export("sampled")] string Sampled { get; } // @property (readonly, nonatomic) NSString * _Nullable replayId; - [NullAllowed, Export ("replayId")] + [NullAllowed, Export("replayId")] string ReplayId { get; } // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; - [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] - NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); + [Export("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] + NativeHandle Constructor(SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampleRand:(NSString * _Nullable)sampleRand sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; - [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] - NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); + [Export("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] + NativeHandle Constructor(SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); // -(instancetype _Nullable)initWithScope:(SentryScope * _Nonnull)scope options:(SentryOptions * _Nonnull)options; - [Export ("initWithScope:options:")] - NativeHandle Constructor (SentryScope scope, SentryOptions options); + [Export("initWithScope:options:")] + NativeHandle Constructor(SentryScope scope, SentryOptions options); // -(instancetype _Nullable)initWithDict:(NSDictionary * _Nonnull)dictionary; - [Export ("initWithDict:")] - NativeHandle Constructor (NSDictionary dictionary); + [Export("initWithDict:")] + NativeHandle Constructor(NSDictionary dictionary); // -(instancetype _Nullable)initWithTracer:(SentryTracer * _Nonnull)tracer scope:(SentryScope * _Nullable)scope options:(SentryOptions * _Nonnull)options; - [Export ("initWithTracer:scope:options:")] - NativeHandle Constructor (SentryTracer tracer, [NullAllowed] SentryScope scope, SentryOptions options); + [Export("initWithTracer:scope:options:")] + NativeHandle Constructor(SentryTracer tracer, [NullAllowed] SentryScope scope, SentryOptions options); // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId options:(SentryOptions * _Nonnull)options userSegment:(NSString * _Nullable)userSegment replayId:(NSString * _Nullable)replayId; - [Export ("initWithTraceId:options:userSegment:replayId:")] - NativeHandle Constructor (SentryId traceId, SentryOptions options, [NullAllowed] string userSegment, [NullAllowed] string replayId); + [Export("initWithTraceId:options:userSegment:replayId:")] + NativeHandle Constructor(SentryId traceId, SentryOptions options, [NullAllowed] string userSegment, [NullAllowed] string replayId); // -(SentryBaggage * _Nonnull)toBaggage; - [Export ("toBaggage")] + [Export("toBaggage")] SentryBaggage ToBaggage(); } // @interface SentryTraceHeader : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] interface SentryTraceHeader { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; - [Export ("traceId")] + [Export("traceId")] SentryId TraceId { get; } // @property (readonly, nonatomic) SentrySpanId * _Nonnull spanId; - [Export ("spanId")] + [Export("spanId")] SentrySpanId SpanId { get; } // @property (readonly, nonatomic) SentrySampleDecision sampled; - [Export ("sampled")] + [Export("sampled")] SentrySampleDecision Sampled { get; } // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId sampled:(SentrySampleDecision)sampled; - [Export ("initWithTraceId:spanId:sampled:")] - NativeHandle Constructor (SentryId traceId, SentrySpanId spanId, SentrySampleDecision sampled); + [Export("initWithTraceId:spanId:sampled:")] + NativeHandle Constructor(SentryId traceId, SentrySpanId spanId, SentrySampleDecision sampled); // -(NSString * _Nonnull)value; - [Export ("value")] + [Export("value")] string Value { get; } } // @interface SentryTransactionContext : SentrySpanContext -[BaseType (typeof(SentrySpanContext))] +[BaseType(typeof(SentrySpanContext))] [DisableDefaultCtor] [Internal] interface SentryTransactionContext { // @property (readonly, nonatomic) NSString * _Nonnull name; - [Export ("name")] + [Export("name")] string Name { get; } // @property (readonly, nonatomic) SentryTransactionNameSource nameSource; - [Export ("nameSource")] + [Export("nameSource")] SentryTransactionNameSource NameSource { get; } // @property (nonatomic, strong) NSNumber * _Nullable sampleRate; - [NullAllowed, Export ("sampleRate", ArgumentSemantic.Strong)] + [NullAllowed, Export("sampleRate", ArgumentSemantic.Strong)] NSNumber SampleRate { get; set; } // @property (nonatomic, strong) NSNumber * _Nullable sampleRand; - [NullAllowed, Export ("sampleRand", ArgumentSemantic.Strong)] + [NullAllowed, Export("sampleRand", ArgumentSemantic.Strong)] NSNumber SampleRand { get; set; } // @property (nonatomic) SentrySampleDecision parentSampled; - [Export ("parentSampled", ArgumentSemantic.Assign)] + [Export("parentSampled", ArgumentSemantic.Assign)] SentrySampleDecision ParentSampled { get; set; } // @property (nonatomic, strong) NSNumber * _Nullable parentSampleRate; - [NullAllowed, Export ("parentSampleRate", ArgumentSemantic.Strong)] + [NullAllowed, Export("parentSampleRate", ArgumentSemantic.Strong)] NSNumber ParentSampleRate { get; set; } // @property (nonatomic, strong) NSNumber * _Nullable parentSampleRand; - [NullAllowed, Export ("parentSampleRand", ArgumentSemantic.Strong)] + [NullAllowed, Export("parentSampleRand", ArgumentSemantic.Strong)] NSNumber ParentSampleRand { get; set; } // @property (assign, nonatomic) BOOL forNextAppLaunch; - [Export ("forNextAppLaunch")] + [Export("forNextAppLaunch")] bool ForNextAppLaunch { get; set; } // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation; - [Export ("initWithName:operation:")] - NativeHandle Constructor (string name, string operation); + [Export("initWithName:operation:")] + NativeHandle Constructor(string name, string operation); // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled __attribute__((deprecated("Use initWithName:operation:sampled:sampleRate:sampleRand instead"))); - [Export ("initWithName:operation:sampled:")] - NativeHandle Constructor (string name, string operation, SentrySampleDecision sampled); + [Export("initWithName:operation:sampled:")] + NativeHandle Constructor(string name, string operation, SentrySampleDecision sampled); // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled sampleRate:(NSNumber * _Nullable)sampleRate sampleRand:(NSNumber * _Nullable)sampleRand; - [Export ("initWithName:operation:sampled:sampleRate:sampleRand:")] - NativeHandle Constructor (string name, string operation, SentrySampleDecision sampled, [NullAllowed] NSNumber sampleRate, [NullAllowed] NSNumber sampleRand); + [Export("initWithName:operation:sampled:sampleRate:sampleRand:")] + NativeHandle Constructor(string name, string operation, SentrySampleDecision sampled, [NullAllowed] NSNumber sampleRate, [NullAllowed] NSNumber sampleRand); // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation traceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentSpanId:(SentrySpanId * _Nullable)parentSpanId parentSampled:(SentrySampleDecision)parentSampled __attribute__((deprecated("Use initWithName:operation:traceId:spanId:parentSpanId:parentSampled:parentSampleRate:parentSampleRand instead"))); - [Export ("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:")] - NativeHandle Constructor (string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled); + [Export("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:")] + NativeHandle Constructor(string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled); // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation traceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentSpanId:(SentrySpanId * _Nullable)parentSpanId parentSampled:(SentrySampleDecision)parentSampled parentSampleRate:(NSNumber * _Nullable)parentSampleRate parentSampleRand:(NSNumber * _Nullable)parentSampleRand; - [Export ("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:parentSampleRate:parentSampleRand:")] - NativeHandle Constructor (string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled, [NullAllowed] NSNumber parentSampleRate, [NullAllowed] NSNumber parentSampleRand); + [Export("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:parentSampleRate:parentSampleRand:")] + NativeHandle Constructor(string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled, [NullAllowed] NSNumber parentSampleRate, [NullAllowed] NSNumber parentSampleRand); } // @interface SentryUser : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] -interface SentryUser : ISentrySerializable{ +interface SentryUser : ISentrySerializable +{ // @property (copy, atomic) NSString * _Nullable userId; - [NullAllowed, Export ("userId")] + [NullAllowed, Export("userId")] string UserId { get; set; } // @property (copy, atomic) NSString * _Nullable email; - [NullAllowed, Export ("email")] + [NullAllowed, Export("email")] string Email { get; set; } // @property (copy, atomic) NSString * _Nullable username; - [NullAllowed, Export ("username")] + [NullAllowed, Export("username")] string Username { get; set; } // @property (copy, atomic) NSString * _Nullable ipAddress; - [NullAllowed, Export ("ipAddress")] + [NullAllowed, Export("ipAddress")] string IpAddress { get; set; } // @property (copy, atomic) DEPRECATED_MSG_ATTRIBUTE("This field is deprecated and will be removed in the next major update.") NSString * segment __attribute__((deprecated("This field is deprecated and will be removed in the next major update."))); - [Export ("segment")] + [Export("segment")] string Segment { get; set; } // @property (copy, atomic) NSString * _Nullable name; - [NullAllowed, Export ("name")] + [NullAllowed, Export("name")] string Name { get; set; } // @property (nonatomic, strong) SentryGeo * _Nullable geo; - [NullAllowed, Export ("geo", ArgumentSemantic.Strong)] + [NullAllowed, Export("geo", ArgumentSemantic.Strong)] SentryGeo Geo { get; set; } // @property (atomic, strong) NSDictionary * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Strong)] + [NullAllowed, Export("data", ArgumentSemantic.Strong)] NSDictionary Data { get; set; } // -(instancetype _Nonnull)initWithUserId:(NSString * _Nonnull)userId; - [Export ("initWithUserId:")] - NativeHandle Constructor (string userId); + [Export("initWithUserId:")] + NativeHandle Constructor(string userId); // -(BOOL)isEqualToUser:(SentryUser * _Nonnull)user; - [Export ("isEqualToUser:")] - bool IsEqualToUser (SentryUser user); + [Export("isEqualToUser:")] + bool IsEqualToUser(SentryUser user); // -(NSUInteger)hash; - [Export ("hash")] + [Export("hash")] nuint Hash { get; } } // @interface SentryFeedback : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] [DisableDefaultCtor] [Internal] interface SentryFeedback { // @property (readonly, nonatomic, strong) SentryId * _Nonnull eventId; - [Export ("eventId", ArgumentSemantic.Strong)] + [Export("eventId", ArgumentSemantic.Strong)] SentryId EventId { get; } // -(instancetype _Nonnull)initWithMessage:(NSString * _Nonnull)message name:(NSString * _Nullable)name email:(NSString * _Nullable)email source:(enum SentryFeedbackSource)source associatedEventId:(SentryId * _Nullable)associatedEventId attachments:(NSArray * _Nullable)attachments __attribute__((objc_designated_initializer)); - [Export ("initWithMessage:name:email:source:associatedEventId:attachments:")] + [Export("initWithMessage:name:email:source:associatedEventId:attachments:")] [DesignatedInitializer] - NativeHandle Constructor (string message, [NullAllowed] string name, [NullAllowed] string email, SentryFeedbackSource source, [NullAllowed] SentryId associatedEventId, [NullAllowed] NSData[] attachments); + NativeHandle Constructor(string message, [NullAllowed] string name, [NullAllowed] string email, SentryFeedbackSource source, [NullAllowed] SentryId associatedEventId, [NullAllowed] NSData[] attachments); } // @interface SentryId : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry8SentryId")] [Internal] interface SentryId { // @property (readonly, nonatomic, strong, class) SentryId * _Nonnull empty; [Static] - [Export ("empty", ArgumentSemantic.Strong)] + [Export("empty", ArgumentSemantic.Strong)] SentryId Empty { get; } // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; - [Export ("sentryIdString")] + [Export("sentryIdString")] string SentryIdString { get; } // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); - [Export ("initWithUuid:")] + [Export("initWithUuid:")] [DesignatedInitializer] - NativeHandle Constructor (NSUuid uuid); + NativeHandle Constructor(NSUuid uuid); // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); - [Export ("initWithUUIDString:")] + [Export("initWithUUIDString:")] [DesignatedInitializer] - NativeHandle Constructor (string uuidString); + NativeHandle Constructor(string uuidString); // @property (readonly, nonatomic) NSUInteger hash; - [Export ("hash")] + [Export("hash")] nuint Hash { get; } } // @interface SentryLog : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] [DisableDefaultCtor] [Internal] interface SentryLog { // @property (copy, nonatomic) NSDate * _Nonnull timestamp; - [Export ("timestamp", ArgumentSemantic.Copy)] + [Export("timestamp", ArgumentSemantic.Copy)] NSDate Timestamp { get; set; } // @property (nonatomic, strong) SentryId * _Nonnull traceId; - [Export ("traceId", ArgumentSemantic.Strong)] + [Export("traceId", ArgumentSemantic.Strong)] SentryId TraceId { get; set; } // @property (nonatomic) enum SentryStructuredLogLevel level; - [Export ("level", ArgumentSemantic.Assign)] + [Export("level", ArgumentSemantic.Assign)] SentryStructuredLogLevel Level { get; set; } // @property (copy, nonatomic) NSString * _Nonnull body; - [Export ("body")] + [Export("body")] string Body { get; set; } // @property (nonatomic, strong) NSNumber * _Nullable severityNumber; - [NullAllowed, Export ("severityNumber", ArgumentSemantic.Strong)] + [NullAllowed, Export("severityNumber", ArgumentSemantic.Strong)] NSNumber SeverityNumber { get; set; } } // @interface SentryLogger : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry12SentryLogger")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry12SentryLogger")] [DisableDefaultCtor] [Internal] interface SentryLogger { // -(void)trace:(NSString * _Nonnull)body; - [Export ("trace:")] - void Trace (string body); + [Export("trace:")] + void Trace(string body); // -(void)trace:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("trace:attributes:")] - void Trace (string body, NSDictionary attributes); + [Export("trace:attributes:")] + void Trace(string body, NSDictionary attributes); // -(void)debug:(NSString * _Nonnull)body; - [Export ("debug:")] - void Debug (string body); + [Export("debug:")] + void Debug(string body); // -(void)debug:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("debug:attributes:")] - void Debug (string body, NSDictionary attributes); + [Export("debug:attributes:")] + void Debug(string body, NSDictionary attributes); // -(void)info:(NSString * _Nonnull)body; - [Export ("info:")] - void Info (string body); + [Export("info:")] + void Info(string body); // -(void)info:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("info:attributes:")] - void Info (string body, NSDictionary attributes); + [Export("info:attributes:")] + void Info(string body, NSDictionary attributes); // -(void)warn:(NSString * _Nonnull)body; - [Export ("warn:")] - void Warn (string body); + [Export("warn:")] + void Warn(string body); // -(void)warn:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("warn:attributes:")] - void Warn (string body, NSDictionary attributes); + [Export("warn:attributes:")] + void Warn(string body, NSDictionary attributes); // -(void)error:(NSString * _Nonnull)body; - [Export ("error:")] - void Error (string body); + [Export("error:")] + void Error(string body); // -(void)error:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("error:attributes:")] - void Error (string body, NSDictionary attributes); + [Export("error:attributes:")] + void Error(string body, NSDictionary attributes); // -(void)fatal:(NSString * _Nonnull)body; - [Export ("fatal:")] - void Fatal (string body); + [Export("fatal:")] + void Fatal(string body); // -(void)fatal:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; - [Export ("fatal:attributes:")] - void Fatal (string body, NSDictionary attributes); + [Export("fatal:attributes:")] + void Fatal(string body, NSDictionary attributes); } // @interface SentryProfileOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry20SentryProfileOptions")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry20SentryProfileOptions")] [Internal] interface SentryProfileOptions { // @property (nonatomic) enum SentryProfileLifecycle lifecycle; - [Export ("lifecycle", ArgumentSemantic.Assign)] + [Export("lifecycle", ArgumentSemantic.Assign)] SentryProfileLifecycle Lifecycle { get; set; } // @property (nonatomic) float sessionSampleRate; - [Export ("sessionSampleRate")] + [Export("sessionSampleRate")] float SessionSampleRate { get; set; } // @property (nonatomic) BOOL profileAppStarts; - [Export ("profileAppStarts")] + [Export("profileAppStarts")] bool ProfileAppStarts { get; set; } } @@ -2273,22 +2277,22 @@ interface ISentryRRWebEvent : ISentrySerializable } // @interface SentryRRWebEvent : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] [DisableDefaultCtor] [Internal] interface SentryRRWebEvent : ISentryRRWebEvent { // @property (readonly, copy, nonatomic) NSDictionary * _Nullable data; - [NullAllowed, Export ("data", ArgumentSemantic.Copy)] + [NullAllowed, Export("data", ArgumentSemantic.Copy)] NSDictionary Data { get; } // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); } // @protocol SentryRedactOptions -[Protocol (Name = "_TtP6Sentry19SentryRedactOptions_")] +[Protocol(Name = "_TtP6Sentry19SentryRedactOptions_")] [Internal] [Model] [BaseType (typeof(NSObject))] @@ -2296,666 +2300,668 @@ interface ISentryRedactOptions { // @required @property (readonly, nonatomic) BOOL maskAllText; [Abstract] - [Export ("maskAllText")] + [Export("maskAllText")] bool MaskAllText { get; } // @required @property (readonly, nonatomic) BOOL maskAllImages; [Abstract] - [Export ("maskAllImages")] + [Export("maskAllImages")] bool MaskAllImages { get; } // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull maskedViewClasses; [Abstract] - [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + [Export("maskedViewClasses", ArgumentSemantic.Copy)] Class[] MaskedViewClasses { get; } // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; [Abstract] - [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + [Export("unmaskedViewClasses", ArgumentSemantic.Copy)] Class[] UnmaskedViewClasses { get; } } // @protocol SentryReplayBreadcrumbConverter -[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] -[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[Protocol(Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[BaseType(typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] [Internal] interface SentryReplayBreadcrumbConverter { // @required -(id _Nullable)convertFrom:(SentryBreadcrumb * _Nonnull)breadcrumb __attribute__((warn_unused_result(""))); [Abstract] - [Export ("convertFrom:")] + [Export("convertFrom:")] [return: NullAllowed] - SentryRRWebEvent ConvertFrom (SentryBreadcrumb breadcrumb); + SentryRRWebEvent ConvertFrom(SentryBreadcrumb breadcrumb); } // @interface SentryReplayOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] [Internal] interface SentryReplayOptions : ISentryRedactOptions { // @property (nonatomic) float sessionSampleRate; - [Export ("sessionSampleRate")] + [Export("sessionSampleRate")] float SessionSampleRate { get; set; } // @property (nonatomic) float onErrorSampleRate; - [Export ("onErrorSampleRate")] + [Export("onErrorSampleRate")] float OnErrorSampleRate { get; set; } // @property (nonatomic) BOOL maskAllText; - [Export ("maskAllText")] + [Export("maskAllText")] bool MaskAllText { get; set; } // @property (nonatomic) BOOL maskAllImages; - [Export ("maskAllImages")] + [Export("maskAllImages")] bool MaskAllImages { get; set; } // @property (nonatomic) enum SentryReplayQuality quality; - [Export ("quality", ArgumentSemantic.Assign)] + [Export("quality", ArgumentSemantic.Assign)] SentryReplayQuality Quality { get; set; } // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; - [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + [Export("maskedViewClasses", ArgumentSemantic.Copy)] Class[] MaskedViewClasses { get; set; } // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; - [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + [Export("unmaskedViewClasses", ArgumentSemantic.Copy)] Class[] UnmaskedViewClasses { get; set; } // @property (nonatomic) BOOL enableExperimentalViewRenderer __attribute__((deprecated("", "enableViewRendererV2"))); - [Export ("enableExperimentalViewRenderer")] + [Export("enableExperimentalViewRenderer")] bool EnableExperimentalViewRenderer { get; set; } // @property (nonatomic) BOOL enableViewRendererV2; - [Export ("enableViewRendererV2")] + [Export("enableViewRendererV2")] bool EnableViewRendererV2 { get; set; } // @property (nonatomic) BOOL enableFastViewRendering; - [Export ("enableFastViewRendering")] + [Export("enableFastViewRendering")] bool EnableFastViewRendering { get; set; } // @property (readonly, nonatomic) NSInteger replayBitRate; - [Export ("replayBitRate")] + [Export("replayBitRate")] nint ReplayBitRate { get; } // @property (readonly, nonatomic) float sizeScale; - [Export ("sizeScale")] + [Export("sizeScale")] float SizeScale { get; } // @property (nonatomic) NSUInteger frameRate; - [Export ("frameRate")] + [Export("frameRate")] nuint FrameRate { get; set; } // @property (nonatomic) NSTimeInterval errorReplayDuration; - [Export ("errorReplayDuration")] + [Export("errorReplayDuration")] double ErrorReplayDuration { get; set; } // @property (nonatomic) NSTimeInterval sessionSegmentDuration; - [Export ("sessionSegmentDuration")] + [Export("sessionSegmentDuration")] double SessionSegmentDuration { get; set; } // @property (nonatomic) NSTimeInterval maximumDuration; - [Export ("maximumDuration")] + [Export("maximumDuration")] double MaximumDuration { get; set; } // -(instancetype _Nonnull)initWithDictionary:(NSDictionary * _Nonnull)dictionary; - [Export ("initWithDictionary:")] - NativeHandle Constructor (NSDictionary dictionary); + [Export("initWithDictionary:")] + NativeHandle Constructor(NSDictionary dictionary); // -(instancetype _Nonnull)initWithSessionSampleRate:(float)sessionSampleRate onErrorSampleRate:(float)onErrorSampleRate maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages enableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering; - [Export ("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:enableViewRendererV2:enableFastViewRendering:")] - NativeHandle Constructor (float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages, bool enableViewRendererV2, bool enableFastViewRendering); + [Export("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:enableViewRendererV2:enableFastViewRendering:")] + NativeHandle Constructor(float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages, bool enableViewRendererV2, bool enableFastViewRendering); } // @interface SentrySDK : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] [Internal] interface SentrySDK { // @property (readonly, nonatomic, strong, class) id _Nullable span; [Static] - [NullAllowed, Export ("span", ArgumentSemantic.Strong)] + [NullAllowed, Export("span", ArgumentSemantic.Strong)] SentrySpan Span { get; } // @property (readonly, nonatomic, class) BOOL isEnabled; [Static] - [Export ("isEnabled")] + [Export("isEnabled")] bool IsEnabled { get; } // @property (readonly, nonatomic, strong, class) SentryReplayApi * _Nonnull replay; [Static] - [Export ("replay", ArgumentSemantic.Strong)] + [Export("replay", ArgumentSemantic.Strong)] SentryReplayApi Replay { get; } // @property (readonly, nonatomic, strong, class) SentryLogger * _Nonnull logger; [Static] - [Export ("logger", ArgumentSemantic.Strong)] + [Export("logger", ArgumentSemantic.Strong)] SentryLogger Logger { get; } // +(void)startWithOptions:(SentryOptions * _Nonnull)options; [Static] - [Export ("startWithOptions:")] - void StartWithOptions (SentryOptions options); + [Export("startWithOptions:")] + void StartWithOptions(SentryOptions options); // +(void)startWithConfigureOptions:(void (^ _Nonnull)(SentryOptions * _Nonnull))configureOptions; [Static] - [Export ("startWithConfigureOptions:")] - void StartWithConfigureOptions (Action configureOptions); + [Export("startWithConfigureOptions:")] + void StartWithConfigureOptions(Action configureOptions); // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event; [Static] - [Export ("captureEvent:")] - SentryId CaptureEvent (SentryEvent @event); + [Export("captureEvent:")] + SentryId CaptureEvent(SentryEvent @event); // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope; [Static] - [Export ("captureEvent:withScope:")] - SentryId CaptureEvent (SentryEvent @event, SentryScope scope); + [Export("captureEvent:withScope:")] + SentryId CaptureEvent(SentryEvent @event, SentryScope scope); // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; [Static] - [Export ("captureEvent:withScopeBlock:")] - SentryId CaptureEvent (SentryEvent @event, Action block); + [Export("captureEvent:withScopeBlock:")] + SentryId CaptureEvent(SentryEvent @event, Action block); // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation; [Static] - [Export ("startTransactionWithName:operation:")] - SentrySpan StartTransactionWithName (string name, string operation); + [Export("startTransactionWithName:operation:")] + SentrySpan StartTransactionWithName(string name, string operation); // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope; [Static] - [Export ("startTransactionWithName:operation:bindToScope:")] - SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); + [Export("startTransactionWithName:operation:bindToScope:")] + SentrySpan StartTransactionWithName(string name, string operation, bool bindToScope); // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext; [Static] - [Export ("startTransactionWithContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); + [Export("startTransactionWithContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext); // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope; [Static] - [Export ("startTransactionWithContext:bindToScope:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); + [Export("startTransactionWithContext:bindToScope:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, bool bindToScope); // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; [Static] - [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); + [Export("startTransactionWithContext:bindToScope:customSamplingContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; [Static] - [Export ("startTransactionWithContext:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); + [Export("startTransactionWithContext:customSamplingContext:")] + SentrySpan StartTransactionWithContext(SentryTransactionContext transactionContext, NSDictionary customSamplingContext); // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error; [Static] - [Export ("captureError:")] - SentryId CaptureError (NSError error); + [Export("captureError:")] + SentryId CaptureError(NSError error); // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope; [Static] - [Export ("captureError:withScope:")] - SentryId CaptureError (NSError error, SentryScope scope); + [Export("captureError:withScope:")] + SentryId CaptureError(NSError error, SentryScope scope); // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; [Static] - [Export ("captureError:withScopeBlock:")] - SentryId CaptureError (NSError error, Action block); + [Export("captureError:withScopeBlock:")] + SentryId CaptureError(NSError error, Action block); // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception; [Static] - [Export ("captureException:")] - SentryId CaptureException (NSException exception); + [Export("captureException:")] + SentryId CaptureException(NSException exception); // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope; [Static] - [Export ("captureException:withScope:")] - SentryId CaptureException (NSException exception, SentryScope scope); + [Export("captureException:withScope:")] + SentryId CaptureException(NSException exception, SentryScope scope); // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; [Static] - [Export ("captureException:withScopeBlock:")] - SentryId CaptureException (NSException exception, Action block); + [Export("captureException:withScopeBlock:")] + SentryId CaptureException(NSException exception, Action block); // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message; [Static] - [Export ("captureMessage:")] - SentryId CaptureMessage (string message); + [Export("captureMessage:")] + SentryId CaptureMessage(string message); // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope; [Static] - [Export ("captureMessage:withScope:")] - SentryId CaptureMessage (string message, SentryScope scope); + [Export("captureMessage:withScope:")] + SentryId CaptureMessage(string message, SentryScope scope); // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; [Static] - [Export ("captureMessage:withScopeBlock:")] - SentryId CaptureMessage (string message, Action block); + [Export("captureMessage:withScopeBlock:")] + SentryId CaptureMessage(string message, Action block); // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; [Static] - [Export ("captureFeedback:")] - void CaptureFeedback (SentryFeedback feedback); + [Export("captureFeedback:")] + void CaptureFeedback(SentryFeedback feedback); [Static] - [Export ("feedback", ArgumentSemantic.Strong)] + [Export("feedback", ArgumentSemantic.Strong)] SentryFeedbackAPI Feedback { get; } // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb; [Static] - [Export ("addBreadcrumb:")] - void AddBreadcrumb (SentryBreadcrumb crumb); + [Export("addBreadcrumb:")] + void AddBreadcrumb(SentryBreadcrumb crumb); // +(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; [Static] - [Export ("configureScope:")] - void ConfigureScope (Action callback); + [Export("configureScope:")] + void ConfigureScope(Action callback); // @property (readonly, nonatomic, class) BOOL crashedLastRun; [Static] - [Export ("crashedLastRun")] + [Export("crashedLastRun")] bool CrashedLastRun { get; } // @property (readonly, nonatomic, class) BOOL detectedStartUpCrash; [Static] - [Export ("detectedStartUpCrash")] + [Export("detectedStartUpCrash")] bool DetectedStartUpCrash { get; } // +(void)setUser:(SentryUser * _Nullable)user; [Static] - [Export ("setUser:")] - void SetUser ([NullAllowed] SentryUser user); + [Export("setUser:")] + void SetUser([NullAllowed] SentryUser user); // +(void)startSession; [Static] - [Export ("startSession")] - void StartSession (); + [Export("startSession")] + void StartSession(); // +(void)endSession; [Static] - [Export ("endSession")] - void EndSession (); + [Export("endSession")] + void EndSession(); // +(void)crash; [Static] - [Export ("crash")] - void Crash (); + [Export("crash")] + void Crash(); // +(void)reportFullyDisplayed; [Static] - [Export ("reportFullyDisplayed")] - void ReportFullyDisplayed (); + [Export("reportFullyDisplayed")] + void ReportFullyDisplayed(); // +(void)pauseAppHangTracking; [Static] - [Export ("pauseAppHangTracking")] - void PauseAppHangTracking (); + [Export("pauseAppHangTracking")] + void PauseAppHangTracking(); // +(void)resumeAppHangTracking; [Static] - [Export ("resumeAppHangTracking")] - void ResumeAppHangTracking (); + [Export("resumeAppHangTracking")] + void ResumeAppHangTracking(); // +(void)flush:(NSTimeInterval)timeout; [Static] - [Export ("flush:")] - void Flush (double timeout); + [Export("flush:")] + void Flush(double timeout); // +(void)close; [Static] - [Export ("close")] - void Close (); + [Export("close")] + void Close(); // +(void)startProfiler; [Static] - [Export ("startProfiler")] - void StartProfiler (); + [Export("startProfiler")] + void StartProfiler(); // +(void)stopProfiler; [Static] - [Export ("stopProfiler")] - void StopProfiler (); + [Export("stopProfiler")] + void StopProfiler(); // +(void)clearLogger; [Static] - [Export ("clearLogger")] - void ClearLogger (); + [Export("clearLogger")] + void ClearLogger(); } // @interface SentrySession : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] [DisableDefaultCtor] [Internal] -interface SentrySession { +interface SentrySession +{ // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); - [Export ("initWithReleaseName:distinctId:")] + [Export("initWithReleaseName:distinctId:")] [DesignatedInitializer] - NativeHandle Constructor (string releaseName, string distinctId); + NativeHandle Constructor(string releaseName, string distinctId); // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); - [Export ("initWithJSONObject:")] + [Export("initWithJSONObject:")] [DesignatedInitializer] - NativeHandle Constructor (NSDictionary jsonObject); + NativeHandle Constructor(NSDictionary jsonObject); // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionExitedWithTimestamp:")] - void EndSessionExitedWithTimestamp (NSDate timestamp); + [Export("endSessionExitedWithTimestamp:")] + void EndSessionExitedWithTimestamp(NSDate timestamp); // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionCrashedWithTimestamp:")] - void EndSessionCrashedWithTimestamp (NSDate timestamp); + [Export("endSessionCrashedWithTimestamp:")] + void EndSessionCrashedWithTimestamp(NSDate timestamp); // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionAbnormalWithTimestamp:")] - void EndSessionAbnormalWithTimestamp (NSDate timestamp); + [Export("endSessionAbnormalWithTimestamp:")] + void EndSessionAbnormalWithTimestamp(NSDate timestamp); // -(void)incrementErrors; - [Export ("incrementErrors")] - void IncrementErrors (); + [Export("incrementErrors")] + void IncrementErrors(); // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; - [Export ("sessionId", ArgumentSemantic.Copy)] + [Export("sessionId", ArgumentSemantic.Copy)] NSUuid SessionId { get; } // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; - [Export ("started", ArgumentSemantic.Copy)] + [Export("started", ArgumentSemantic.Copy)] NSDate Started { get; } // @property (readonly, nonatomic) enum SentrySessionStatus status; - [Export ("status")] + [Export("status")] SentrySessionStatus Status { get; } // @property (nonatomic) NSUInteger errors; - [Export ("errors")] + [Export("errors")] nuint Errors { get; set; } // @property (readonly, nonatomic) NSUInteger sequence; - [Export ("sequence")] + [Export("sequence")] nuint Sequence { get; } // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; - [Export ("distinctId")] + [Export("distinctId")] string DistinctId { get; } // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; - [NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)] + [NullAllowed, Export("flagInit", ArgumentSemantic.Strong)] NSNumber FlagInit { get; } // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; - [NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)] + [NullAllowed, Export("timestamp", ArgumentSemantic.Copy)] NSDate Timestamp { get; } // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; - [NullAllowed, Export ("duration", ArgumentSemantic.Strong)] + [NullAllowed, Export("duration", ArgumentSemantic.Strong)] NSNumber Duration { get; } // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] + [NullAllowed, Export("releaseName")] string ReleaseName { get; } // @property (copy, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] + [NullAllowed, Export("environment")] string Environment { get; set; } // @property (nonatomic, strong) SentryUser * _Nullable user; - [NullAllowed, Export ("user", ArgumentSemantic.Strong)] + [NullAllowed, Export("user", ArgumentSemantic.Strong)] SentryUser User { get; set; } // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; - [NullAllowed, Export ("abnormalMechanism")] + [NullAllowed, Export("abnormalMechanism")] string AbnormalMechanism { get; set; } // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); - [Export ("serialize")] + [Export("serialize")] NSDictionary Serialize(); // -(void)setFlagInit; - [Export ("setFlagInit")] - void SetFlagInit (); + [Export("setFlagInit")] + void SetFlagInit(); } // @protocol SentryViewScreenshotProvider -[Protocol (Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] -[BaseType (typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[Protocol(Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[BaseType(typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] [Internal] interface SentryViewScreenshotProvider { // @required -(void)imageWithView:(UIView * _Nonnull)view onComplete:(void (^ _Nonnull)(UIImage * _Nonnull))onComplete; [Abstract] - [Export ("imageWithView:onComplete:")] - void OnComplete (UIView view, Action onComplete); + [Export("imageWithView:onComplete:")] + void OnComplete(UIView view, Action onComplete); } // @interface SentryViewScreenshotOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] +[BaseType(typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] [Internal] interface SentryViewScreenshotOptions : ISentryRedactOptions { // @property (nonatomic) BOOL enableViewRendererV2; - [Export ("enableViewRendererV2")] + [Export("enableViewRendererV2")] bool EnableViewRendererV2 { get; set; } // @property (nonatomic) BOOL enableFastViewRendering; - [Export ("enableFastViewRendering")] + [Export("enableFastViewRendering")] bool EnableFastViewRendering { get; set; } // @property (nonatomic) BOOL maskAllImages; - [Export ("maskAllImages")] + [Export("maskAllImages")] bool MaskAllImages { get; set; } // @property (nonatomic) BOOL maskAllText; - [Export ("maskAllText")] + [Export("maskAllText")] bool MaskAllText { get; set; } // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; - [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + [Export("maskedViewClasses", ArgumentSemantic.Copy)] Class[] MaskedViewClasses { get; set; } // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; - [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + [Export("unmaskedViewClasses", ArgumentSemantic.Copy)] Class[] UnmaskedViewClasses { get; set; } // -(instancetype _Nonnull)initWithEnableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages maskedViewClasses:(NSArray * _Nonnull)maskedViewClasses unmaskedViewClasses:(NSArray * _Nonnull)unmaskedViewClasses __attribute__((objc_designated_initializer)); - [Export ("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] + [Export("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] [DesignatedInitializer] - NativeHandle Constructor (bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); + NativeHandle Constructor(bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); } // @interface SentryScreenFrames : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryScreenFrames { +interface SentryScreenFrames +{ // -(instancetype _Nonnull)initWithTotal:(NSUInteger)total frozen:(NSUInteger)frozen slow:(NSUInteger)slow; - [Export ("initWithTotal:frozen:slow:")] - NativeHandle Constructor (nuint total, nuint frozen, nuint slow); + [Export("initWithTotal:frozen:slow:")] + NativeHandle Constructor(nuint total, nuint frozen, nuint slow); // -(instancetype _Nonnull)initWithTotal:(NSUInteger)total frozen:(NSUInteger)frozen slow:(NSUInteger)slow slowFrameTimestamps:(SentryFrameInfoTimeSeries * _Nonnull)slowFrameTimestamps frozenFrameTimestamps:(SentryFrameInfoTimeSeries * _Nonnull)frozenFrameTimestamps frameRateTimestamps:(SentryFrameInfoTimeSeries * _Nonnull)frameRateTimestamps; - [Export ("initWithTotal:frozen:slow:slowFrameTimestamps:frozenFrameTimestamps:frameRateTimestamps:")] - NativeHandle Constructor (nuint total, nuint frozen, nuint slow, NSDictionary[] slowFrameTimestamps, NSDictionary[] frozenFrameTimestamps, NSDictionary[] frameRateTimestamps); + [Export("initWithTotal:frozen:slow:slowFrameTimestamps:frozenFrameTimestamps:frameRateTimestamps:")] + NativeHandle Constructor(nuint total, nuint frozen, nuint slow, NSDictionary[] slowFrameTimestamps, NSDictionary[] frozenFrameTimestamps, NSDictionary[] frameRateTimestamps); // @property (readonly, assign, nonatomic) NSUInteger total; - [Export ("total")] + [Export("total")] nuint Total { get; } // @property (readonly, assign, nonatomic) NSUInteger frozen; - [Export ("frozen")] + [Export("frozen")] nuint Frozen { get; } // @property (readonly, assign, nonatomic) NSUInteger slow; - [Export ("slow")] + [Export("slow")] nuint Slow { get; } // @property (readonly, copy, nonatomic) SentryFrameInfoTimeSeries * _Nonnull slowFrameTimestamps; - [Export ("slowFrameTimestamps", ArgumentSemantic.Copy)] + [Export("slowFrameTimestamps", ArgumentSemantic.Copy)] NSDictionary[] SlowFrameTimestamps { get; } // @property (readonly, copy, nonatomic) SentryFrameInfoTimeSeries * _Nonnull frozenFrameTimestamps; - [Export ("frozenFrameTimestamps", ArgumentSemantic.Copy)] + [Export("frozenFrameTimestamps", ArgumentSemantic.Copy)] NSDictionary[] FrozenFrameTimestamps { get; } // @property (readonly, copy, nonatomic) SentryFrameInfoTimeSeries * _Nonnull frameRateTimestamps; - [Export ("frameRateTimestamps", ArgumentSemantic.Copy)] + [Export("frameRateTimestamps", ArgumentSemantic.Copy)] NSDictionary[] FrameRateTimestamps { get; } } // @interface PrivateSentrySDKOnly : NSObject -[BaseType (typeof(NSObject))] +[BaseType(typeof(NSObject))] [Internal] interface PrivateSentrySDKOnly { // +(NSArray * _Nonnull)getDebugImages; [Static] - [Export ("getDebugImages")] + [Export("getDebugImages")] SentryDebugMeta[] DebugImages { get; } // +(NSArray * _Nonnull)getDebugImagesCrashed:(BOOL)isCrash; [Static] - [Export ("getDebugImagesCrashed:")] - SentryDebugMeta[] GetDebugImagesCrashed (bool isCrash); + [Export("getDebugImagesCrashed:")] + SentryDebugMeta[] GetDebugImagesCrashed(bool isCrash); // +(void)setSdkName:(NSString * _Nonnull)sdkName andVersionString:(NSString * _Nonnull)versionString; [Static] - [Export ("setSdkName:andVersionString:")] - void SetSdkName (string sdkName, string versionString); + [Export("setSdkName:andVersionString:")] + void SetSdkName(string sdkName, string versionString); // +(void)setSdkName:(NSString * _Nonnull)sdkName; [Static] - [Export ("setSdkName:")] - void SetSdkName (string sdkName); + [Export("setSdkName:")] + void SetSdkName(string sdkName); // +(NSString * _Nonnull)getSdkName; [Static] - [Export ("getSdkName")] + [Export("getSdkName")] string SdkName { get; } // +(NSString * _Nonnull)getSdkVersionString; [Static] - [Export ("getSdkVersionString")] + [Export("getSdkVersionString")] string SdkVersionString { get; } // +(void)addSdkPackage:(NSString * _Nonnull)name version:(NSString * _Nonnull)version; [Static] - [Export ("addSdkPackage:version:")] - void AddSdkPackage (string name, string version); + [Export("addSdkPackage:version:")] + void AddSdkPackage(string name, string version); // +(NSDictionary * _Nonnull)getExtraContext; [Static] - [Export ("getExtraContext")] + [Export("getExtraContext")] NSDictionary ExtraContext { get; } // +(void)setTrace:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId; [Static] - [Export ("setTrace:spanId:")] - void SetTrace (SentryId traceId, SentrySpanId spanId); + [Export("setTrace:spanId:")] + void SetTrace(SentryId traceId, SentrySpanId spanId); // +(uint64_t)startProfilerForTrace:(SentryId * _Nonnull)traceId; [Static] - [Export ("startProfilerForTrace:")] - ulong StartProfilerForTrace (SentryId traceId); + [Export("startProfilerForTrace:")] + ulong StartProfilerForTrace(SentryId traceId); // +(NSMutableDictionary * _Nullable)collectProfileBetween:(uint64_t)startSystemTime and:(uint64_t)endSystemTime forTrace:(SentryId * _Nonnull)traceId; [Static] - [Export ("collectProfileBetween:and:forTrace:")] + [Export("collectProfileBetween:and:forTrace:")] [return: NullAllowed] - NSMutableDictionary CollectProfileBetween (ulong startSystemTime, ulong endSystemTime, SentryId traceId); + NSMutableDictionary CollectProfileBetween(ulong startSystemTime, ulong endSystemTime, SentryId traceId); // +(void)discardProfilerForTrace:(SentryId * _Nonnull)traceId; [Static] - [Export ("discardProfilerForTrace:")] - void DiscardProfilerForTrace (SentryId traceId); + [Export("discardProfilerForTrace:")] + void DiscardProfilerForTrace(SentryId traceId); // @property (readonly, copy, nonatomic, class) NSString * _Nonnull installationID; [Static] - [Export ("installationID")] + [Export("installationID")] string InstallationID { get; } // @property (readonly, copy, nonatomic, class) SentryOptions * _Nonnull options; [Static] - [Export ("options", ArgumentSemantic.Copy)] + [Export("options", ArgumentSemantic.Copy)] SentryOptions Options { get; } // @property (assign, nonatomic, class) BOOL framesTrackingMeasurementHybridSDKMode; [Static] - [Export ("framesTrackingMeasurementHybridSDKMode")] + [Export("framesTrackingMeasurementHybridSDKMode")] bool FramesTrackingMeasurementHybridSDKMode { get; set; } // @property (readonly, assign, nonatomic, class) BOOL isFramesTrackingRunning; [Static] - [Export ("isFramesTrackingRunning")] + [Export("isFramesTrackingRunning")] bool IsFramesTrackingRunning { get; } // @property (readonly, assign, nonatomic, class) SentryScreenFrames * _Nonnull currentScreenFrames; [Static] - [Export ("currentScreenFrames", ArgumentSemantic.Assign)] + [Export("currentScreenFrames", ArgumentSemantic.Assign)] SentryScreenFrames CurrentScreenFrames { get; } // +(NSArray * _Nonnull)captureScreenshots; [Static] - [Export ("captureScreenshots")] + [Export("captureScreenshots")] NSData[] CaptureScreenshots(); // +(NSData * _Nonnull)captureViewHierarchy; [Static] - [Export ("captureViewHierarchy")] + [Export("captureViewHierarchy")] NSData CaptureViewHierarchy(); // +(void)setCurrentScreen:(NSString * _Nullable)screenName; [Static] - [Export ("setCurrentScreen:")] - void SetCurrentScreen ([NullAllowed] string screenName); + [Export("setCurrentScreen:")] + void SetCurrentScreen([NullAllowed] string screenName); // +(UIView * _Nonnull)sessionReplayMaskingOverlay:(id _Nonnull)options; [Static] - [Export ("sessionReplayMaskingOverlay:")] - UIView SessionReplayMaskingOverlay (SentryRedactOptions options); + [Export("sessionReplayMaskingOverlay:")] + UIView SessionReplayMaskingOverlay(SentryRedactOptions options); // +(void)configureSessionReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; [Static] - [Export ("configureSessionReplayWith:screenshotProvider:")] - void ConfigureSessionReplayWith ([NullAllowed] SentryReplayBreadcrumbConverter breadcrumbConverter, [NullAllowed] SentryViewScreenshotProvider screenshotProvider); + [Export("configureSessionReplayWith:screenshotProvider:")] + void ConfigureSessionReplayWith([NullAllowed] SentryReplayBreadcrumbConverter breadcrumbConverter, [NullAllowed] SentryViewScreenshotProvider screenshotProvider); // +(void)captureReplay; [Static] - [Export ("captureReplay")] - void CaptureReplay (); + [Export("captureReplay")] + void CaptureReplay(); // +(NSString * _Nullable)getReplayId; [Static] - [NullAllowed, Export ("getReplayId")] + [NullAllowed, Export("getReplayId")] string ReplayId { get; } // +(void)addReplayIgnoreClasses:(NSArray * _Nonnull)classes; [Static] - [Export ("addReplayIgnoreClasses:")] - void AddReplayIgnoreClasses (Class[] classes); + [Export("addReplayIgnoreClasses:")] + void AddReplayIgnoreClasses(Class[] classes); // +(void)addReplayRedactClasses:(NSArray * _Nonnull)classes; [Static] - [Export ("addReplayRedactClasses:")] - void AddReplayRedactClasses (Class[] classes); + [Export("addReplayRedactClasses:")] + void AddReplayRedactClasses(Class[] classes); // +(void)setIgnoreContainerClass:(Class _Nonnull)containerClass; [Static] - [Export ("setIgnoreContainerClass:")] - void SetIgnoreContainerClass (Class containerClass); + [Export("setIgnoreContainerClass:")] + void SetIgnoreContainerClass(Class containerClass); // +(void)setRedactContainerClass:(Class _Nonnull)containerClass; [Static] - [Export ("setRedactContainerClass:")] - void SetRedactContainerClass (Class containerClass); + [Export("setRedactContainerClass:")] + void SetRedactContainerClass(Class containerClass); // +(void)setReplayTags:(NSDictionary * _Nonnull)tags; [Static] - [Export ("setReplayTags:")] - void SetReplayTags (NSDictionary tags); + [Export("setReplayTags:")] + void SetReplayTags(NSDictionary tags); // +(SentryUser * _Nonnull)userWithDictionary:(NSDictionary * _Nonnull)dictionary; [Static] - [Export ("userWithDictionary:")] - SentryUser UserWithDictionary (NSDictionary dictionary); + [Export("userWithDictionary:")] + SentryUser UserWithDictionary(NSDictionary dictionary); // +(SentryBreadcrumb * _Nonnull)breadcrumbWithDictionary:(NSDictionary * _Nonnull)dictionary; [Static] - [Export ("breadcrumbWithDictionary:")] - SentryBreadcrumb BreadcrumbWithDictionary (NSDictionary dictionary); -} + [Export("breadcrumbWithDictionary:")] + SentryBreadcrumb BreadcrumbWithDictionary(NSDictionary dictionary); +} \ No newline at end of file diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 900af913af..22074f14af 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -1,6 +1,8 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Formatting; +using CodeFormatter = Microsoft.CodeAnalysis.Formatting.Formatter; if (args.Length != 1) { @@ -145,7 +147,8 @@ "SentryViewScreenshotProvider" ); -File.WriteAllText(args[0], nodes.ToFullString().TabsToSpaces()); +var formatted = CodeFormatter.Format(nodes, new AdhocWorkspace()); +File.WriteAllText(args[0], formatted.ToFullString()); internal static class FilterExtensions { @@ -473,10 +476,8 @@ public static bool Matches(this string str, string pattern) return false; } - var regex = "^" + Regex.Escape(pattern) - .Replace("\\*", ".*") - .Replace("\\?", ".") + "$"; - return Regex.IsMatch(str, regex); + var regex = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", "."); + return Regex.IsMatch(str, $"^{regex}$"); } public static string TabsToSpaces(this string str, int spacesPerTab = 4) diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj index cd9e9995be..0978e2d8ce 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj @@ -9,6 +9,7 @@ + From 85f6fa5a97bc6a044b6e53ab4822ee0ca5b41cdf Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 14:24:54 +0100 Subject: [PATCH 20/36] StronglyTypedNSArray --- scripts/generate-cocoa-bindings.ps1 | 4 --- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 6 ++-- .../Program.cs | 35 +++++++++++++++++-- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 06908211fc..5ae419b572 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,10 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Allow weakly typed NSArray -# We have some that accept either NSString or NSRegularExpression, which have no common type so they use NSObject -$Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' - # Fix broken multi-line comments $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index f771c7c400..6732085825 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -1564,7 +1564,8 @@ interface SentryOptions bool EnableAutoBreadcrumbTracking { get; set; } // @property (retain, nonatomic) NSArray * _Nonnull tracePropagationTargets; - [Export("tracePropagationTargets", ArgumentSemantic.Retain)] NSObject[] TracePropagationTargets { get; set; } + [Export("tracePropagationTargets", ArgumentSemantic.Retain)] + NSObject[] TracePropagationTargets { get; set; } // @property (assign, nonatomic) BOOL enableCaptureFailedRequests; [Export("enableCaptureFailedRequests")] @@ -1575,7 +1576,8 @@ interface SentryOptions SentryHttpStatusCodeRange[] FailedRequestStatusCodes { get; set; } // @property (nonatomic, strong) NSArray * _Nonnull failedRequestTargets; - [Export("failedRequestTargets", ArgumentSemantic.Strong)] NSObject[] FailedRequestTargets { get; set; } + [Export("failedRequestTargets", ArgumentSemantic.Strong)] + NSObject[] FailedRequestTargets { get; set; } // @property (assign, nonatomic) BOOL enableMetricKit __attribute__((availability(ios, introduced=15.0))) __attribute__((availability(macos, introduced=12.0))) __attribute__((availability(maccatalyst, introduced=15.0))) __attribute__((availability(tvos, unavailable))) __attribute__((availability(watchos, unavailable))); [NoWatch, NoTV, MacCatalyst(15, 0)] diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 22074f14af..860e643285 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -30,12 +30,14 @@ // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 .Blacklist("INSCopying") .Blacklist("") - // Fix/verify property-to-method conversions + // Fix property-to-method conversions .PropertyToMethod("Sentry*.Serialize") .PropertyToMethod("SentrySpan.ToTraceHeader") .PropertyToMethod("SentryTraceContext.ToBaggage") .PropertyToMethod("PrivateSentrySDKOnly.Capture*") - .Blacklist("Verify") // TODO: MethodToProperty predicate + // Verify + .Verify("*Sentry*.*", "MethodToProperty") // TODO: replace broad pattern with one-by-one verification + .Verify("SentryOptions.*Targets", "StronglyTypedNSArray") // Fix delegate argument names .Rename("arg*", "error", p => p.Type?.ToString() == "NSError") .Rename("arg*", "response", p => p.Type?.ToString() == "NSHttpUrlResponse") @@ -237,7 +239,7 @@ public static CompilationUnitSyntax BaseType( string name, string baseType) { - return root.Attribute($"BaseType (typeof({baseType}))", iface => iface.Matches(name)); + return root.Attribute($"BaseType (typeof({baseType}))", iface => iface.Matches(name)); } public static CompilationUnitSyntax Rename( @@ -312,6 +314,31 @@ public static CompilationUnitSyntax PropertyToMethod(this CompilationUnitSyntax .WithTrailingTrivia(original.GetTrailingTrivia()); }); } + + public static CompilationUnitSyntax Verify( + this CompilationUnitSyntax root, + string typeName, + string verify) where T : MemberDeclarationSyntax + { + return root.ReplaceNodes( + root.DescendantNodes().OfType().Where(node => node.Matches(typeName)), + (original, _) => + { + var newAttrLists = original.AttributeLists + .Select(al => al.WithAttributes( + SyntaxFactory.SeparatedList( + al.Attributes.Where(attr => + !(attr.Name.ToString() == "Verify" && + attr.ArgumentList != null && + attr.ArgumentList.Arguments.ToString().Matches(verify)) + ) + ) + )) + .Where(al => al.Attributes.Count > 0); + + return original.WithAttributeLists(SyntaxFactory.List(newAttrLists)); + }); + } } internal static class SyntaxNodeExtensions @@ -329,6 +356,8 @@ public static string GetIdentifier(this SyntaxNode node) AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), BaseTypeSyntax type => type.Type.ToString(), BaseListSyntax list => string.Join(",", list.Types.Select(t => t.Type.ToString())), + FileScopedNamespaceDeclarationSyntax ns => ns.Name.ToString(), + NamespaceDeclarationSyntax ns => ns.Name.ToString(), _ => throw new NotSupportedException(node.GetType().Name) }; } From 49c1000e436ca33e1cfd77fa59807f0cabbeb587 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 14:32:14 +0100 Subject: [PATCH 21/36] DEPRECATED_MSG_ATTRIBUTE --- scripts/generate-cocoa-bindings.ps1 | 4 ---- tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 5ae419b572..f393b6ad94 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -224,10 +224,6 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Fix broken multi-line comments -$Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' -$Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' - # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 860e643285..8eacea39f6 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -11,6 +11,10 @@ } var code = File.ReadAllText(args[0]); +// Fix broken multi-line comments +code = Regex.Replace(code, @"(DEPRECATED_MSG_ATTRIBUTE\()\n\s*", "$1"); +code = Regex.Replace(code, @"(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)""\s*\r?\n\s*""", "$1 "); + var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() .Namespace("Sentry.CocoaSdk") From 5339c6b15e0d14bdfc118934d960833524ae7e38 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 15:01:01 +0100 Subject: [PATCH 22/36] StructsAndEnums --- scripts/generate-cocoa-bindings.ps1 | 21 ++++++------------- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 2 +- .../Program.cs | 17 +++++++++++++++ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index f393b6ad94..3befb9a4b1 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -197,25 +197,16 @@ Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $Text = Get-Content "$BindingsPath/$File" -Raw -# Tabs to spaces -$Text = $Text -replace '\t', ' ' - -# Trim extra newline at EOF -$Text = $Text -replace '\n$', '' - -# Insert namespace -$Text = $Text -replace 'using .+;\n\n', "$&namespace Sentry.CocoaSdk;`n`n" - -# Public to internal -$Text = $Text -replace '\bpublic\b', 'internal' - -# Remove static CFunctions class -$Text = $Text -replace '(?ms)\nstatic class CFunctions.*?}\n', '' - # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" +################################################################################ +# Post-process StructsAndEnums.cs +################################################################################ +Write-Output "Post-processing $BindingsPath/$File" +& dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } + ################################################################################ # Patch ApiDefinitions.cs ################################################################################ diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index f1813ab486..40956cea75 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -146,4 +146,4 @@ internal enum SentryTransactionNameSource : long View = 3, Component = 4, Task = 5 -} +} \ No newline at end of file diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 8eacea39f6..547d7ffa31 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -18,6 +18,8 @@ var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() .Namespace("Sentry.CocoaSdk") + .Blacklist("CFunctions") + .Access("Sentry*", SyntaxKind.InternalKeyword) // Set Internal attributes on all interfaces and delegates .Attribute("Internal") .Attribute("Internal") @@ -343,6 +345,20 @@ public static CompilationUnitSyntax Verify( return original.WithAttributeLists(SyntaxFactory.List(newAttrLists)); }); } + + public static CompilationUnitSyntax Access( + this CompilationUnitSyntax root, + string name, + SyntaxKind modifier, + Func? predicate = null) where T : MemberDeclarationSyntax + { + var nodes = root.DescendantNodes().OfType() + .Where(node => node.Matches(name) && (predicate == null || predicate(node))); + + return root.ReplaceNodes(nodes, (original, _) => + original.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(modifier))) + ); + } } internal static class SyntaxNodeExtensions @@ -352,6 +368,7 @@ public static string GetIdentifier(this SyntaxNode node) return node switch { TypeDeclarationSyntax type => type.Identifier.Text, + EnumDeclarationSyntax type => type.Identifier.Text, DelegateDeclarationSyntax del => del.Identifier.Text, MethodDeclarationSyntax method => method.Identifier.Text, PropertyDeclarationSyntax property => property.Identifier.Text, From a46c3852d5a5820857159b50652e8a088292e776 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 15:08:11 +0100 Subject: [PATCH 23/36] Header --- scripts/generate-cocoa-bindings.ps1 | 30 ------------------- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 6 ++-- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 6 ++-- .../Program.cs | 10 ++++++- 4 files changed, 15 insertions(+), 37 deletions(-) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 3befb9a4b1..a3beecb8a9 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -179,32 +179,12 @@ if (!(Test-Path $BackupPath)) New-Item -ItemType Directory -Path $BackupPath | Out-Null } -# The following header will be added to patched files. The notice applies -# to those files, not this script which generates the files. -$Header = @" -// ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the script -// at /scripts/generate-cocoa-bindings.ps1. Do not edit this file directly. -// If changes are required, update the script instead. -// ----------------------------------------------------------------------------- -"@ - ################################################################################ # Patch StructsAndEnums.cs ################################################################################ $File = 'StructsAndEnums.cs' Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" -$Text = Get-Content "$BindingsPath/$File" -Raw - -# Add header and output file -$Text = "$Header`n`n$Text" -$Text | Out-File "$BindingsPath/$File" - -################################################################################ -# Post-process StructsAndEnums.cs -################################################################################ -Write-Output "Post-processing $BindingsPath/$File" & dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } ################################################################################ @@ -213,14 +193,4 @@ Write-Output "Post-processing $BindingsPath/$File" $File = 'ApiDefinitions.cs' Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" -$Text = Get-Content "$BindingsPath/$File" -Raw - -# Add header and output file -$Text = "$Header`n`n$Text" -$Text | Out-File "$BindingsPath/$File" - -################################################################################ -# Post-process ApiDefinitions.cs -################################################################################ -Write-Output "Post-processing $BindingsPath/$File" & dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 6732085825..cb06cc237f 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the script -// at /scripts/generate-cocoa-bindings.ps1. Do not edit this file directly. -// If changes are required, update the script instead. +// This file is auto-generated by Objective Sharpie and patched via the tool +// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// If changes are required, update the tool instead. // ----------------------------------------------------------------------------- using System; diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 40956cea75..de396b71e6 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the script -// at /scripts/generate-cocoa-bindings.ps1. Do not edit this file directly. -// If changes are required, update the script instead. +// This file is auto-generated by Objective Sharpie and patched via the tool +// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// If changes are required, update the tool instead. // ----------------------------------------------------------------------------- using System.Runtime.InteropServices; diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs index 547d7ffa31..e76cd4abb3 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -10,7 +10,15 @@ return; } -var code = File.ReadAllText(args[0]); +const string Header = @"// ----------------------------------------------------------------------------- +// This file is auto-generated by Objective Sharpie and patched via the tool +// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// If changes are required, update the tool instead. +// ----------------------------------------------------------------------------- + +"; +var code = Header + File.ReadAllText(args[0]); + // Fix broken multi-line comments code = Regex.Replace(code, @"(DEPRECATED_MSG_ATTRIBUTE\()\n\s*", "$1"); code = Regex.Replace(code, @"(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)""\s*\r?\n\s*""", "$1 "); From b6db1e3e5b0728912b582af67315d9cf5a4f0278 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 15:12:18 +0100 Subject: [PATCH 24/36] Try .NET 10 run script --- .gitignore | 2 +- scripts/generate-cocoa-bindings.ps1 | 6 ++++-- .../Program.cs => scripts/patch-cocoa-bindings.cs | 10 ++++++---- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 4 ++-- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 4 ++-- .../Sentry.Bindings.Cocoa.PostProcessor.csproj | 15 --------------- 6 files changed, 15 insertions(+), 26 deletions(-) rename tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs => scripts/patch-cocoa-bindings.cs (98%) delete mode 100644 tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj diff --git a/.gitignore b/.gitignore index ce13a6a8b0..23c230d87a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ docs/docfx.zip mono_crash.*.json test_output/ test/**/*.apk -/tools/sentry-cli/ +/tools/ *.log .sentry-native **/EnvironmentVariables.g.cs diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index a3beecb8a9..212c08f4d9 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -179,13 +179,15 @@ if (!(Test-Path $BackupPath)) New-Item -ItemType Directory -Path $BackupPath | Out-Null } +Push-Location $PSScriptRoot + ################################################################################ # Patch StructsAndEnums.cs ################################################################################ $File = 'StructsAndEnums.cs' Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" -& dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } +& dotnet run "$PSScriptRoot/patch-cocoa-bindings.cs" "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } ################################################################################ # Patch ApiDefinitions.cs @@ -193,4 +195,4 @@ Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" $File = 'ApiDefinitions.cs' Write-Output "Patching $BindingsPath/$File" Copy-Item "$BindingsPath/$File" -Destination "$BackupPath/$File" -& dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } +& dotnet run "$PSScriptRoot/patch-cocoa-bindings.cs" "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/scripts/patch-cocoa-bindings.cs similarity index 98% rename from tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs rename to scripts/patch-cocoa-bindings.cs index e76cd4abb3..78a46a709b 100644 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -1,18 +1,20 @@ +#:package Microsoft.CodeAnalysis.CSharp@4.10.0 +#:package Microsoft.CodeAnalysis.CSharp.Workspaces@4.10.0 + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Formatting; using CodeFormatter = Microsoft.CodeAnalysis.Formatting.Formatter; if (args.Length != 1) { - Console.Error.WriteLine("Usage: Sentry.Bindings.Cocoa.PostProcessor "); + Console.Error.WriteLine("Usage: patch-cocoa-bindings.cs "); return; } const string Header = @"// ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the tool -// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// This file is auto-generated by Objective Sharpie and patched via the script +// at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. // If changes are required, update the tool instead. // ----------------------------------------------------------------------------- diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index cb06cc237f..3f40c4c530 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the tool -// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// This file is auto-generated by Objective Sharpie and patched via the script +// at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. // If changes are required, update the tool instead. // ----------------------------------------------------------------------------- diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index de396b71e6..ba7cdc0634 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -1,6 +1,6 @@ // ----------------------------------------------------------------------------- -// This file is auto-generated by Objective Sharpie and patched via the tool -// at /tools/Sentry.Bindings.Cocoa.PostProcessor. Do not edit this file directly. +// This file is auto-generated by Objective Sharpie and patched via the script +// at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. // If changes are required, update the tool instead. // ----------------------------------------------------------------------------- diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj deleted file mode 100644 index 0978e2d8ce..0000000000 --- a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - Exe - net9.0 - enable - enable - - - - - - - - From d38c428ea37fc14f9be24ea655e412481ed02777 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 15:46:31 +0100 Subject: [PATCH 25/36] Minor clean up... --- scripts/patch-cocoa-bindings.cs | 34 +++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 78a46a709b..c8c813c733 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -28,11 +28,12 @@ var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() .Namespace("Sentry.CocoaSdk") + // Remove CFunctions class .Blacklist("CFunctions") + // Make enums, interfaces, and delegates internal .Access("Sentry*", SyntaxKind.InternalKeyword) - // Set Internal attributes on all interfaces and delegates - .Attribute("Internal") - .Attribute("Internal") + .Attribute("*Sentry*", "Internal") + .Attribute("Sentry*", "Internal") // Adjust protocols (some are models) .Model("SentryRedactOptions") .Model("SentrySerializable") @@ -69,7 +70,9 @@ // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) - .Attribute("return: NullAllowed", del => del.GetIdentifier() is "SentryBeforeBreadcrumbCallback" or "SentryBeforeSendEventCallback" or "SentryTracesSamplerCallback") + .Attribute("SentryBeforeBreadcrumbCallback", "return: NullAllowed") + .Attribute("SentryBeforeSendEventCallback", "return: NullAllowed") + .Attribute("SentryTracesSamplerCallback", "return: NullAllowed") .Partial("SentryScope") .Blacklist( // error CS0246: The type or namespace name 'iOS' could not be found @@ -206,16 +209,16 @@ public static CompilationUnitSyntax Namespace( public static CompilationUnitSyntax Attribute( this CompilationUnitSyntax root, - string name, - Func? predicate = null) where T : SyntaxNode + string typeName, + string attributeName) where T : SyntaxNode { var nodesToUpdate = root.DescendantNodes() .OfType() - .Where(node => predicate == null || predicate(node)) - .Where(node => !node.HasAttribute(name)) + .Where(node => node.Matches(typeName)) + .Where(node => !node.HasAttribute(attributeName)) .ToList(); - var attribute = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(name)); + var attribute = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(attributeName)); var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(attribute)); var replacements = nodesToUpdate.ToDictionary( @@ -232,8 +235,8 @@ public static CompilationUnitSyntax Model( { var iface = root.DescendantNodes() .OfType() - .Where(i => i.Matches(name)) - .Where(i => i.HasAttribute("Protocol")) + .Where(node => node.Matches(name)) + .Where(node => node.HasAttribute("Protocol")) .FirstOrDefault(); if (iface == null) @@ -246,7 +249,7 @@ public static CompilationUnitSyntax Model( !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains("[Model]")))); var result = root.ReplaceNode(iface, iface.WithLeadingTrivia(trivia)); return isModel - ? result.Attribute("Model", i => i.Matches(name)) + ? result.Attribute(name, "Model") : result; } @@ -255,7 +258,7 @@ public static CompilationUnitSyntax BaseType( string name, string baseType) { - return root.Attribute($"BaseType (typeof({baseType}))", iface => iface.Matches(name)); + return root.Attribute(name, $"BaseType (typeof({baseType}))"); } public static CompilationUnitSyntax Rename( @@ -359,11 +362,10 @@ public static CompilationUnitSyntax Verify( public static CompilationUnitSyntax Access( this CompilationUnitSyntax root, string name, - SyntaxKind modifier, - Func? predicate = null) where T : MemberDeclarationSyntax + SyntaxKind modifier) where T : MemberDeclarationSyntax { var nodes = root.DescendantNodes().OfType() - .Where(node => node.Matches(name) && (predicate == null || predicate(node))); + .Where(node => node.Matches(name)); return root.ReplaceNodes(nodes, (original, _) => original.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(modifier))) From 59f6d78d7e301cd344144c49257fa35b99a0e989 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 15:56:27 +0100 Subject: [PATCH 26/36] Fix comment --- scripts/patch-cocoa-bindings.cs | 2 +- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 2 +- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index c8c813c733..987c2195e8 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -15,7 +15,7 @@ const string Header = @"// ----------------------------------------------------------------------------- // This file is auto-generated by Objective Sharpie and patched via the script // at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. -// If changes are required, update the tool instead. +// If changes are required, update the script instead. // ----------------------------------------------------------------------------- "; diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 3f40c4c530..c1e8fb8605 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- // This file is auto-generated by Objective Sharpie and patched via the script // at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. -// If changes are required, update the tool instead. +// If changes are required, update the script instead. // ----------------------------------------------------------------------------- using System; diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index ba7cdc0634..8f190378a5 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -1,7 +1,7 @@ // ----------------------------------------------------------------------------- // This file is auto-generated by Objective Sharpie and patched via the script // at /scripts/patch-cocoa-bindings.cs. Do not edit this file directly. -// If changes are required, update the tool instead. +// If changes are required, update the script instead. // ----------------------------------------------------------------------------- using System.Runtime.InteropServices; From 63316c88dd4b548a746d4695bfb5ebf1d63bb319 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 16:58:48 +0100 Subject: [PATCH 27/36] Fix rename --- scripts/patch-cocoa-bindings.cs | 54 +++++++++++++-------- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 2 +- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 987c2195e8..34b5de5feb 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -56,17 +56,18 @@ .Verify("*Sentry*.*", "MethodToProperty") // TODO: replace broad pattern with one-by-one verification .Verify("SentryOptions.*Targets", "StronglyTypedNSArray") // Fix delegate argument names - .Rename("arg*", "error", p => p.Type?.ToString() == "NSError") - .Rename("arg*", "response", p => p.Type?.ToString() == "NSHttpUrlResponse") - .Rename("arg*", "@event", p => p.Type?.ToString() == "SentryEvent") - .Rename("arg*", "samplingContext", p => p.Type?.ToString() == "SentrySamplingContext") - .Rename("arg*", "breadcrumb", p => p.Type?.ToString() == "SentryBreadcrumb") - .Rename("arg*", "span", p => p.Type?.ToString() == "SentrySpan") - .Rename("arg*", "log", p => p.Type?.ToString() == "SentryLog") - .Rename("arg*", "options", p => p.Type?.ToString() == "SentryProfileOptions") + .Rename("NSError arg*", "NSError error") + .Rename("NSHttpUrlResponse arg*", "NSHttpUrlResponse response") + .Rename("SentryEvent arg*", "SentryEvent @event") + .Rename("SentrySamplingContext arg*", "SentrySamplingContext samplingContext") + .Rename("SentryBreadcrumb arg*", "SentryBreadcrumb breadcrumb") + .Rename("SentrySpan arg*", "SentrySpan span") + .Rename("SentryLog arg*", "SentryLog log") + .Rename("SentryProfileOptions arg*", "SentryProfileOptions options") // Fix interface names .Rename("SentrySerializable", "ISentrySerializable") .Rename("SentryRedactOptions", "ISentryRedactOptions") + .Rename("SentryRedactOptions options", "ISentryRedactOptions options") // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) @@ -270,7 +271,12 @@ public static CompilationUnitSyntax Rename( var replacements = new Dictionary(); foreach (var node in root.DescendantNodes().OfType()) { - if (node.Matches(oldName) && (predicate == null || predicate(node))) + if (predicate != null && !predicate(node)) + { + continue; + } + + if (node.Matches(oldName)) { replacements[node] = node.WithIdentifier(newName); } @@ -384,7 +390,7 @@ public static string GetIdentifier(this SyntaxNode node) DelegateDeclarationSyntax del => del.Identifier.Text, MethodDeclarationSyntax method => method.Identifier.Text, PropertyDeclarationSyntax property => property.Identifier.Text, - ParameterSyntax param => param.Identifier.Text, + ParameterSyntax param => $"{param.Type} {param.Identifier.Text}", AttributeSyntax attr => attr.Name.ToString(), AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), BaseTypeSyntax type => type.Type.ToString(), @@ -397,16 +403,25 @@ public static string GetIdentifier(this SyntaxNode node) public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) { - var oldIdentifier = node switch + if (node is ParameterSyntax param) { - TypeDeclarationSyntax type => type.Identifier, - DelegateDeclarationSyntax del => del.Identifier, - MethodDeclarationSyntax method => method.Identifier, - PropertyDeclarationSyntax property => property.Identifier, - ParameterSyntax param => param.Identifier, - _ => throw new NotSupportedException(node.GetType().Name) - }; - var newIdentifier = SyntaxFactory.Identifier(newName).WithTrailingTrivia(oldIdentifier.TrailingTrivia); + var parts = newName.Trim().Split(' ', 2, StringSplitOptions.RemoveEmptyEntries); + var newType = parts.Length > 1 ? parts[0] : param.Type?.ToString(); + var newParamName = parts.Length > 1 ? parts[1] : parts[0]; + + var updated = param; + if (newType != null && newType != param.Type?.ToString()) + { + updated = updated.WithType(SyntaxFactory.ParseTypeName(newType)); + } + if (newParamName != param.Identifier.Text) + { + updated = updated.WithIdentifier(SyntaxFactory.Identifier(newParamName)); + } + return updated; + } + + var newIdentifier = SyntaxFactory.Identifier(newName); return node switch { InterfaceDeclarationSyntax iface => iface.WithIdentifier(newIdentifier), @@ -416,7 +431,6 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) DelegateDeclarationSyntax del => del.WithIdentifier(newIdentifier), MethodDeclarationSyntax method => method.WithIdentifier(newIdentifier), PropertyDeclarationSyntax property => property.WithIdentifier(newIdentifier), - ParameterSyntax param => param.WithIdentifier(newIdentifier), _ => throw new NotSupportedException(node.GetType().Name) }; } diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index c1e8fb8605..718e43078d 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -2915,7 +2915,7 @@ interface PrivateSentrySDKOnly // +(UIView * _Nonnull)sessionReplayMaskingOverlay:(id _Nonnull)options; [Static] [Export("sessionReplayMaskingOverlay:")] - UIView SessionReplayMaskingOverlay(SentryRedactOptions options); + UIView SessionReplayMaskingOverlay(ISentryRedactOptions options); // +(void)configureSessionReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; [Static] From 18aabbf54d1a15c251b494d1bfa80bc43e4eddbf Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 17:05:25 +0100 Subject: [PATCH 28/36] Remove SentrySession --- scripts/patch-cocoa-bindings.cs | 1 - src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 93 --------------------- 2 files changed, 94 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 34b5de5feb..6f69d470e5 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -155,7 +155,6 @@ "SentryScope", "SentryScreenFrames", "SentrySDK", - "SentrySession", "SentrySpan", "SentrySpanContext", "SentrySpanId", diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 718e43078d..4ebf73de78 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -2626,99 +2626,6 @@ interface SentrySDK void ClearLogger(); } -// @interface SentrySession : NSObject -[BaseType(typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] -[DisableDefaultCtor] -[Internal] -interface SentrySession -{ - // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); - [Export("initWithReleaseName:distinctId:")] - [DesignatedInitializer] - NativeHandle Constructor(string releaseName, string distinctId); - - // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); - [Export("initWithJSONObject:")] - [DesignatedInitializer] - NativeHandle Constructor(NSDictionary jsonObject); - - // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export("endSessionExitedWithTimestamp:")] - void EndSessionExitedWithTimestamp(NSDate timestamp); - - // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export("endSessionCrashedWithTimestamp:")] - void EndSessionCrashedWithTimestamp(NSDate timestamp); - - // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export("endSessionAbnormalWithTimestamp:")] - void EndSessionAbnormalWithTimestamp(NSDate timestamp); - - // -(void)incrementErrors; - [Export("incrementErrors")] - void IncrementErrors(); - - // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; - [Export("sessionId", ArgumentSemantic.Copy)] - NSUuid SessionId { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; - [Export("started", ArgumentSemantic.Copy)] - NSDate Started { get; } - - // @property (readonly, nonatomic) enum SentrySessionStatus status; - [Export("status")] - SentrySessionStatus Status { get; } - - // @property (nonatomic) NSUInteger errors; - [Export("errors")] - nuint Errors { get; set; } - - // @property (readonly, nonatomic) NSUInteger sequence; - [Export("sequence")] - nuint Sequence { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; - [Export("distinctId")] - string DistinctId { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; - [NullAllowed, Export("flagInit", ArgumentSemantic.Strong)] - NSNumber FlagInit { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; - [NullAllowed, Export("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; - [NullAllowed, Export("duration", ArgumentSemantic.Strong)] - NSNumber Duration { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export("releaseName")] - string ReleaseName { get; } - - // @property (copy, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export("environment")] - string Environment { get; set; } - - // @property (nonatomic, strong) SentryUser * _Nullable user; - [NullAllowed, Export("user", ArgumentSemantic.Strong)] - SentryUser User { get; set; } - - // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; - [NullAllowed, Export("abnormalMechanism")] - string AbnormalMechanism { get; set; } - - // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); - [Export("serialize")] - NSDictionary Serialize(); - - // -(void)setFlagInit; - [Export("setFlagInit")] - void SetFlagInit(); -} - // @protocol SentryViewScreenshotProvider [Protocol(Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] [BaseType(typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] From b595c5796afb1b14e06fd70570af044c2127e212 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 17:26:49 +0100 Subject: [PATCH 29/36] Clean up... --- scripts/patch-cocoa-bindings.cs | 122 ++++++++++++-------------------- 1 file changed, 45 insertions(+), 77 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 6f69d470e5..a1810acbce 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -177,34 +177,30 @@ public static CompilationUnitSyntax Blacklist( this CompilationUnitSyntax root, params string[] names) where T : SyntaxNode { - var nodesToRemove = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() .Where(node => names.Any(node.Matches)); - return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + return root.RemoveNodes(nodes, SyntaxRemoveOptions.KeepNoTrivia)!; } public static CompilationUnitSyntax Whitelist( this CompilationUnitSyntax root, params string[] names) where T : SyntaxNode { - var nodesToRemove = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() .Where(node => !names.Any(node.Matches)); - return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + return root.RemoveNodes(nodes, SyntaxRemoveOptions.KeepNoTrivia)!; } public static CompilationUnitSyntax Namespace( this CompilationUnitSyntax root, string name) { - var namespaceDeclaration = SyntaxFactory.FileScopedNamespaceDeclaration(SyntaxFactory.ParseName(name)) - .WithNamespaceKeyword(SyntaxFactory.Token(SyntaxKind.NamespaceKeyword) - .WithLeadingTrivia(SyntaxFactory.EndOfLine("\n")) - .WithTrailingTrivia(SyntaxFactory.Space)) - .WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); + var node = SyntaxFactory.FileScopedNamespaceDeclaration(SyntaxFactory.ParseName(name)); return SyntaxFactory.CompilationUnit() .WithUsings(root.Usings) - .AddMembers(namespaceDeclaration.WithMembers(root.Members)); + .AddMembers(node.WithMembers(root.Members)); } public static CompilationUnitSyntax Attribute( @@ -212,16 +208,14 @@ public static CompilationUnitSyntax Attribute( string typeName, string attributeName) where T : SyntaxNode { - var nodesToUpdate = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() - .Where(node => node.Matches(typeName)) - .Where(node => !node.HasAttribute(attributeName)) - .ToList(); + .Where(node => node.Matches(typeName) && !node.HasAttribute(attributeName)); var attribute = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(attributeName)); var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(attribute)); - var replacements = nodesToUpdate.ToDictionary( + var replacements = nodes.ToDictionary( node => node, node => node.WithAttribute(attributeList)); @@ -233,21 +227,19 @@ public static CompilationUnitSyntax Model( string name, bool isModel = true) { - var iface = root.DescendantNodes() + var node = root.DescendantNodes() .OfType() - .Where(node => node.Matches(name)) - .Where(node => node.HasAttribute("Protocol")) - .FirstOrDefault(); + .FirstOrDefault(node => node.Matches(name) && node.HasAttribute("Protocol")); - if (iface == null) + if (node == null) { return root; } var trivia = SyntaxFactory.TriviaList( - iface.GetLeadingTrivia().Where(t => + node.GetLeadingTrivia().Where(t => !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains("[Model]")))); - var result = root.ReplaceNode(iface, iface.WithLeadingTrivia(trivia)); + var result = root.ReplaceNode(node, node.WithLeadingTrivia(trivia)); return isModel ? result.Attribute(name, "Model") : result; @@ -267,7 +259,7 @@ public static CompilationUnitSyntax Rename( string newName, Func? predicate = null) where T : SyntaxNode { - var replacements = new Dictionary(); + var nodes = new Dictionary(); foreach (var node in root.DescendantNodes().OfType()) { if (predicate != null && !predicate(node)) @@ -277,28 +269,28 @@ public static CompilationUnitSyntax Rename( if (node.Matches(oldName)) { - replacements[node] = node.WithIdentifier(newName); + nodes[node] = node.WithIdentifier(newName); } } - return root.ReplaceNodes(replacements.Keys, (orig, _) => replacements[orig]); + return root.ReplaceNodes(nodes.Keys, (orig, _) => nodes[orig]); } public static CompilationUnitSyntax Partial( this CompilationUnitSyntax root, string name) { - var iface = root.DescendantNodes() + var node = root.DescendantNodes() .OfType() .FirstOrDefault(i => i.Matches(name)); - if (iface == null) + if (node == null) { return root; } return root.ReplaceNode( - iface, - iface.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword).WithTrailingTrivia(SyntaxFactory.Space)) + node, + node.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword).WithTrailingTrivia(SyntaxFactory.Space)) ); } @@ -332,10 +324,7 @@ public static CompilationUnitSyntax PropertyToMethod(this CompilationUnitSyntax return SyntaxFactory.MethodDeclaration(original.Type, SyntaxFactory.Identifier(original.Identifier.Text)) .WithModifiers(original.Modifiers) .WithAttributeLists(newAttributes) - .WithParameterList(SyntaxFactory.ParameterList()) - .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) - .WithLeadingTrivia(original.GetLeadingTrivia()) - .WithTrailingTrivia(original.GetTrailingTrivia()); + .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); }); } @@ -384,18 +373,15 @@ public static string GetIdentifier(this SyntaxNode node) { return node switch { - TypeDeclarationSyntax type => type.Identifier.Text, - EnumDeclarationSyntax type => type.Identifier.Text, + BaseTypeDeclarationSyntax type => type.Identifier.Text, DelegateDeclarationSyntax del => del.Identifier.Text, MethodDeclarationSyntax method => method.Identifier.Text, PropertyDeclarationSyntax property => property.Identifier.Text, ParameterSyntax param => $"{param.Type} {param.Identifier.Text}", AttributeSyntax attr => attr.Name.ToString(), - AttributeListSyntax list => string.Join(",", list.Attributes.Select(a => a.Name.ToString())), + AttributeListSyntax list => string.Join(" ", list.Attributes.Select(a => a.Name.ToString())), BaseTypeSyntax type => type.Type.ToString(), - BaseListSyntax list => string.Join(",", list.Types.Select(t => t.Type.ToString())), - FileScopedNamespaceDeclarationSyntax ns => ns.Name.ToString(), - NamespaceDeclarationSyntax ns => ns.Name.ToString(), + BaseListSyntax list => string.Join(" ", list.Types.Select(t => t.Type.ToString())), _ => throw new NotSupportedException(node.GetType().Name) }; } @@ -434,9 +420,9 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) }; } - public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax attributeList) + public static SyntaxList GetAttributes(this SyntaxNode node) { - var existingAttributes = node switch + return node switch { InterfaceDeclarationSyntax iface => iface.AttributeLists, ClassDeclarationSyntax cls => cls.AttributeLists, @@ -447,42 +433,29 @@ public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax PropertyDeclarationSyntax property => property.AttributeLists, _ => throw new NotSupportedException(node.GetType().Name) }; + } + + public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax attributeList) + { + var existingAttributes = node.GetAttributes(); + var add = new Func((n, attr) => n switch + { + InterfaceDeclarationSyntax iface => iface.AddAttributeLists(attr), + ClassDeclarationSyntax cls => cls.AddAttributeLists(attr), + StructDeclarationSyntax str => str.AddAttributeLists(attr), + EnumDeclarationSyntax enm => enm.AddAttributeLists(attr), + DelegateDeclarationSyntax del => del.AddAttributeLists(attr), + MethodDeclarationSyntax method => method.AddAttributeLists(attr), + PropertyDeclarationSyntax property => property.AddAttributeLists(attr), + _ => throw new NotSupportedException(n.GetType().Name) + }); if (existingAttributes.Count > 0) { - var listWithTrivia = attributeList.WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); - return node switch - { - InterfaceDeclarationSyntax iface => iface.AddAttributeLists(listWithTrivia), - ClassDeclarationSyntax cls => cls.AddAttributeLists(listWithTrivia), - StructDeclarationSyntax str => str.AddAttributeLists(listWithTrivia), - EnumDeclarationSyntax enm => enm.AddAttributeLists(listWithTrivia), - DelegateDeclarationSyntax del => del.AddAttributeLists(listWithTrivia), - MethodDeclarationSyntax method => method.AddAttributeLists(listWithTrivia), - PropertyDeclarationSyntax property => property.AddAttributeLists(listWithTrivia), - _ => throw new NotSupportedException(node.GetType().Name) - }; + return add(node, attributeList); } - else - { - var listWithTrivia = attributeList - .WithLeadingTrivia(node.GetLeadingTrivia()) - .WithTrailingTrivia(SyntaxFactory.EndOfLine("\n")); - var nodeWithoutLeadingTrivia = node.WithLeadingTrivia(SyntaxFactory.TriviaList()); - - return nodeWithoutLeadingTrivia switch - { - InterfaceDeclarationSyntax iface => iface.AddAttributeLists(listWithTrivia), - ClassDeclarationSyntax cls => cls.AddAttributeLists(listWithTrivia), - StructDeclarationSyntax str => str.AddAttributeLists(listWithTrivia), - EnumDeclarationSyntax enm => enm.AddAttributeLists(listWithTrivia), - DelegateDeclarationSyntax del => del.AddAttributeLists(listWithTrivia), - MethodDeclarationSyntax method => method.AddAttributeLists(listWithTrivia), - PropertyDeclarationSyntax property => property.AddAttributeLists(listWithTrivia), - _ => throw new NotSupportedException(node.GetType().Name) - }; - } + return add(node.WithLeadingTrivia(SyntaxFactory.TriviaList()), attributeList.WithLeadingTrivia(node.GetLeadingTrivia())); } public static string GetQualifiedName(this SyntaxNode node) @@ -554,9 +527,4 @@ public static bool Matches(this string str, string pattern) var regex = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", "."); return Regex.IsMatch(str, $"^{regex}$"); } - - public static string TabsToSpaces(this string str, int spacesPerTab = 4) - { - return str.Replace("\t", new string(' ', spacesPerTab)); - } } From e02c6417afa0b434aac14724c077cac94d47652b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 17:52:52 +0100 Subject: [PATCH 30/36] Restore trailing line-break --- scripts/patch-cocoa-bindings.cs | 2 +- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 2 +- src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index a1810acbce..f4bfd80513 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -169,7 +169,7 @@ ); var formatted = CodeFormatter.Format(nodes, new AdhocWorkspace()); -File.WriteAllText(args[0], formatted.ToFullString()); +File.WriteAllText(args[0], formatted.ToFullString() + "\n"); internal static class FilterExtensions { diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 4ebf73de78..66e6c6c84d 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -2873,4 +2873,4 @@ interface PrivateSentrySDKOnly [Static] [Export("breadcrumbWithDictionary:")] SentryBreadcrumb BreadcrumbWithDictionary(NSDictionary dictionary); -} \ No newline at end of file +} diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 8f190378a5..1077aa21f2 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -146,4 +146,4 @@ internal enum SentryTransactionNameSource : long View = 3, Component = 4, Task = 5 -} \ No newline at end of file +} From d168d4947e0995c50e874029f58997ebb73eb0b7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 20:04:39 +0100 Subject: [PATCH 31/36] Fix interfaces --- scripts/patch-cocoa-bindings.cs | 9 ++-- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 48 ++++++++++----------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index f4bfd80513..c8988dcf0c 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -65,9 +65,8 @@ .Rename("SentryLog arg*", "SentryLog log") .Rename("SentryProfileOptions arg*", "SentryProfileOptions options") // Fix interface names - .Rename("SentrySerializable", "ISentrySerializable") - .Rename("SentryRedactOptions", "ISentryRedactOptions") - .Rename("SentryRedactOptions options", "ISentryRedactOptions options") + .Rename("ISentrySerializable", "SentrySerializable") + .Rename("ISentryRedactOptions", "SentryRedactOptions") // Rename conflicting SentryRRWebEvent (protocol vs. interface) .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) @@ -113,9 +112,7 @@ "SentryOptions.ConfigureUserFeedback" ) .Whitelist( - "ISentryRedactOptions", "ISentryRRWebEvent", - "ISentrySerializable", "PrivateSentrySDKOnly", "SentryAttachment", "SentryBaggage", @@ -155,6 +152,7 @@ "SentryScope", "SentryScreenFrames", "SentrySDK", + "SentrySerializable", "SentrySpan", "SentrySpanContext", "SentrySpanId", @@ -416,6 +414,7 @@ public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) DelegateDeclarationSyntax del => del.WithIdentifier(newIdentifier), MethodDeclarationSyntax method => method.WithIdentifier(newIdentifier), PropertyDeclarationSyntax property => property.WithIdentifier(newIdentifier), + SimpleBaseTypeSyntax type => type.WithType(SyntaxFactory.ParseTypeName(newName)), _ => throw new NotSupportedException(node.GetType().Name) }; } diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 66e6c6c84d..132b2e5a15 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -176,7 +176,7 @@ interface SentryBaggage [DisableDefaultCtor] [Internal] [Model] -interface ISentrySerializable +interface SentrySerializable { // @required -(NSDictionary * _Nonnull)serialize; [Abstract] @@ -187,7 +187,7 @@ interface ISentrySerializable // @interface SentryBreadcrumb : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryBreadcrumb : ISentrySerializable +interface SentryBreadcrumb : SentrySerializable { // @property (nonatomic) SentryLevel level; [Export("level", ArgumentSemantic.Assign)] @@ -330,7 +330,7 @@ interface SentryDebugImageProvider // @interface SentryDebugMeta : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryDebugMeta : ISentrySerializable +interface SentryDebugMeta : SentrySerializable { // @property (copy, nonatomic) NSString * _Nullable uuid; [NullAllowed, Export("uuid")] @@ -394,7 +394,7 @@ interface SentryDsn // @interface SentryEvent : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryEvent : ISentrySerializable +interface SentryEvent : SentrySerializable { // @property (nonatomic, strong) SentryId * _Nonnull eventId; [Export("eventId", ArgumentSemantic.Strong)] @@ -518,7 +518,7 @@ interface SentryEvent : ISentrySerializable [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryException : ISentrySerializable +interface SentryException : SentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull value; [Export("value")] @@ -563,7 +563,7 @@ interface SentryFeedbackAPI // @interface SentryFrame : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryFrame : ISentrySerializable +interface SentryFrame : SentrySerializable { // @property (copy, nonatomic) NSString * _Nullable symbolAddress; [NullAllowed, Export("symbolAddress")] @@ -637,7 +637,7 @@ interface SentryFrame : ISentrySerializable // @interface SentryGeo : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryGeo : ISentrySerializable +interface SentryGeo : SentrySerializable { // @property (copy, atomic) NSString * _Nullable city; [NullAllowed, Export("city")] @@ -687,7 +687,7 @@ interface SentryHttpStatusCodeRange [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentrySpanContext : ISentrySerializable +interface SentrySpanContext : SentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; [Export("traceId")] @@ -739,7 +739,7 @@ interface SentrySpanContext : ISentrySerializable [Internal] [Model] [BaseType (typeof(NSObject))] -interface SentrySpan : ISentrySerializable +interface SentrySpan : SentrySerializable { // @required @property (nonatomic, strong) SentryId * _Nonnull traceId; [Abstract] @@ -1174,7 +1174,7 @@ interface SentryMeasurementUnitFraction [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMechanism : ISentrySerializable +interface SentryMechanism : SentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull type; [Export("type")] @@ -1212,7 +1212,7 @@ interface SentryMechanism : ISentrySerializable // @interface SentryMechanismMeta : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryMechanismMeta : ISentrySerializable +interface SentryMechanismMeta : SentrySerializable { // @property (nonatomic, strong) NSDictionary * _Nullable signal; [NullAllowed, Export("signal", ArgumentSemantic.Strong)] @@ -1231,7 +1231,7 @@ interface SentryMechanismMeta : ISentrySerializable [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryMessage : ISentrySerializable +interface SentryMessage : SentrySerializable { // -(instancetype _Nonnull)initWithFormatted:(NSString * _Nonnull)formatted; [Export("initWithFormatted:")] @@ -1254,7 +1254,7 @@ interface SentryMessage : ISentrySerializable [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryNSError : ISentrySerializable +interface SentryNSError : SentrySerializable { // @property (copy, nonatomic) NSString * _Nonnull domain; [Export("domain")] @@ -1663,7 +1663,7 @@ interface SentryReplayApi // @interface SentryRequest : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryRequest : ISentrySerializable +interface SentryRequest : SentrySerializable { // @property (copy, nonatomic) NSNumber * _Nullable bodySize; [NullAllowed, Export("bodySize", ArgumentSemantic.Copy)] @@ -1719,7 +1719,7 @@ interface SentrySamplingContext // @interface SentryScope : NSObject [BaseType(typeof(NSObject))] [Internal] -partial interface SentryScope : ISentrySerializable +partial interface SentryScope : SentrySerializable { // @property (nonatomic, strong) id _Nullable span; [NullAllowed, Export("span", ArgumentSemantic.Strong)] @@ -1858,7 +1858,7 @@ interface SentrySpanId [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryStacktrace : ISentrySerializable +interface SentryStacktrace : SentrySerializable { // @property (nonatomic, strong) NSArray * _Nonnull frames; [Export("frames", ArgumentSemantic.Strong)] @@ -1885,7 +1885,7 @@ interface SentryStacktrace : ISentrySerializable [BaseType(typeof(NSObject))] [DisableDefaultCtor] [Internal] -interface SentryThread : ISentrySerializable +interface SentryThread : SentrySerializable { // @property (copy, nonatomic) NSNumber * _Nonnull threadId; [Export("threadId", ArgumentSemantic.Copy)] @@ -1919,7 +1919,7 @@ interface SentryThread : ISentrySerializable // @interface SentryTraceContext : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryTraceContext : ISentrySerializable +interface SentryTraceContext : SentrySerializable { // @property (readonly, nonatomic) SentryId * _Nonnull traceId; [Export("traceId")] @@ -2079,7 +2079,7 @@ interface SentryTransactionContext // @interface SentryUser : NSObject [BaseType(typeof(NSObject))] [Internal] -interface SentryUser : ISentrySerializable +interface SentryUser : SentrySerializable { // @property (copy, atomic) NSString * _Nullable userId; [NullAllowed, Export("userId")] @@ -2274,7 +2274,7 @@ interface SentryProfileOptions // @protocol SentryRRWebEvent [Protocol] [Internal] -interface ISentryRRWebEvent : ISentrySerializable +interface ISentryRRWebEvent : SentrySerializable { } @@ -2298,7 +2298,7 @@ interface SentryRRWebEvent : ISentryRRWebEvent [Internal] [Model] [BaseType (typeof(NSObject))] -interface ISentryRedactOptions +interface SentryRedactOptions { // @required @property (readonly, nonatomic) BOOL maskAllText; [Abstract] @@ -2337,7 +2337,7 @@ interface SentryReplayBreadcrumbConverter // @interface SentryReplayOptions : NSObject [BaseType(typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] [Internal] -interface SentryReplayOptions : ISentryRedactOptions +interface SentryReplayOptions : SentryRedactOptions { // @property (nonatomic) float sessionSampleRate; [Export("sessionSampleRate")] @@ -2641,7 +2641,7 @@ interface SentryViewScreenshotProvider // @interface SentryViewScreenshotOptions : NSObject [BaseType(typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] [Internal] -interface SentryViewScreenshotOptions : ISentryRedactOptions +interface SentryViewScreenshotOptions : SentryRedactOptions { // @property (nonatomic) BOOL enableViewRendererV2; [Export("enableViewRendererV2")] @@ -2822,7 +2822,7 @@ interface PrivateSentrySDKOnly // +(UIView * _Nonnull)sessionReplayMaskingOverlay:(id _Nonnull)options; [Static] [Export("sessionReplayMaskingOverlay:")] - UIView SessionReplayMaskingOverlay(ISentryRedactOptions options); + UIView SessionReplayMaskingOverlay(SentryRedactOptions options); // +(void)configureSessionReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; [Static] From 0efe6820fd10d81ae73e267e630e1c15c85bac0f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 Oct 2025 20:11:32 +0100 Subject: [PATCH 32/36] Shorten switch-cases --- scripts/patch-cocoa-bindings.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index c8988dcf0c..64dcaa7736 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -423,10 +423,7 @@ public static SyntaxList GetAttributes(this SyntaxNode node { return node switch { - InterfaceDeclarationSyntax iface => iface.AttributeLists, - ClassDeclarationSyntax cls => cls.AttributeLists, - StructDeclarationSyntax str => str.AttributeLists, - EnumDeclarationSyntax enm => enm.AttributeLists, + BaseTypeDeclarationSyntax type => type.AttributeLists, DelegateDeclarationSyntax del => del.AttributeLists, MethodDeclarationSyntax method => method.AttributeLists, PropertyDeclarationSyntax property => property.AttributeLists, @@ -439,10 +436,7 @@ public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax var existingAttributes = node.GetAttributes(); var add = new Func((n, attr) => n switch { - InterfaceDeclarationSyntax iface => iface.AddAttributeLists(attr), - ClassDeclarationSyntax cls => cls.AddAttributeLists(attr), - StructDeclarationSyntax str => str.AddAttributeLists(attr), - EnumDeclarationSyntax enm => enm.AddAttributeLists(attr), + BaseTypeDeclarationSyntax type => type.AddAttributeLists(attr), DelegateDeclarationSyntax del => del.AddAttributeLists(attr), MethodDeclarationSyntax method => method.AddAttributeLists(attr), PropertyDeclarationSyntax property => property.AddAttributeLists(attr), From c426d6174dc412d3efa22e4ac57417901cfa70c1 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 31 Oct 2025 08:47:54 +0100 Subject: [PATCH 33/36] Refactor --- scripts/patch-cocoa-bindings.cs | 586 +++++++++++++++----------------- 1 file changed, 281 insertions(+), 305 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 64dcaa7736..8c8d696135 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -27,91 +27,82 @@ var tree = CSharpSyntaxTree.ParseText(code); var nodes = tree.GetCompilationUnitRoot() - .Namespace("Sentry.CocoaSdk") - // Remove CFunctions class - .Blacklist("CFunctions") + .WithNamespace("Sentry.CocoaSdk") + .RemoveClass("CFunctions") // Make enums, interfaces, and delegates internal - .Access("Sentry*", SyntaxKind.InternalKeyword) - .Attribute("*Sentry*", "Internal") - .Attribute("Sentry*", "Internal") + .AsInternal("Sentry*", "internal") + .WithAttribute("*Sentry*", "Internal") // Adjust protocols (some are models) - .Model("SentryRedactOptions") - .Model("SentrySerializable") - .Model("SentrySpan") - .Model("SentryRRWebEvent", false) - .Model("SentryReplayBreadcrumbConverter", false) - .Model("SentryViewScreenshotProvider", false) + .VerifyModel("SentryRedactOptions") + .VerifyModel("SentrySerializable") + .VerifyModel("SentrySpan") + .RemoveComment("SentryRRWebEvent", "[Model]") + .RemoveComment("SentryReplayBreadcrumbConverter", "[Model]") + .RemoveComment("SentryViewScreenshotProvider", "[Model]") // Adjust base types - .BaseType("SentrySpan", "NSObject") - .BaseType("SentryRedactOptions", "NSObject") + .WithAttribute("SentrySpan", "BaseType (typeof(NSObject))") + .WithAttribute("SentryRedactOptions", "BaseType (typeof(NSObject))") // Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 - .Blacklist("INSCopying") - .Blacklist("") + .RemoveBaseType("INSCopying") // Fix property-to-method conversions - .PropertyToMethod("Sentry*.Serialize") - .PropertyToMethod("SentrySpan.ToTraceHeader") - .PropertyToMethod("SentryTraceContext.ToBaggage") - .PropertyToMethod("PrivateSentrySDKOnly.Capture*") - // Verify - .Verify("*Sentry*.*", "MethodToProperty") // TODO: replace broad pattern with one-by-one verification - .Verify("SentryOptions.*Targets", "StronglyTypedNSArray") + .PropertyToMethod("Sentry*", "Serialize") + .PropertyToMethod("SentrySpan", "ToTraceHeader") + .PropertyToMethod("SentryTraceContext", "ToBaggage") + .PropertyToMethod("PrivateSentrySDKOnly", "Capture*") + // Verify the rest + .VerifyProperty("*Sentry*", "*", "MethodToProperty") // TODO: replace broad patterns with one-by-one verification + .VerifyProperty("SentryOptions", "*Targets", "StronglyTypedNSArray") // Fix delegate argument names - .Rename("NSError arg*", "NSError error") - .Rename("NSHttpUrlResponse arg*", "NSHttpUrlResponse response") - .Rename("SentryEvent arg*", "SentryEvent @event") - .Rename("SentrySamplingContext arg*", "SentrySamplingContext samplingContext") - .Rename("SentryBreadcrumb arg*", "SentryBreadcrumb breadcrumb") - .Rename("SentrySpan arg*", "SentrySpan span") - .Rename("SentryLog arg*", "SentryLog log") - .Rename("SentryProfileOptions arg*", "SentryProfileOptions options") + .RenameParameter("NSError", "arg*", "error") + .RenameParameter("NSHttpUrlResponse", "arg*", "response") + .RenameParameter("SentryEvent", "arg*", "@event") + .RenameParameter("SentrySamplingContext", "arg*", "samplingContext") + .RenameParameter("SentryBreadcrumb", "arg*", "breadcrumb") + .RenameParameter("SentrySpan", "arg*", "span") + .RenameParameter("SentryLog", "arg*", "log") + .RenameParameter("SentryProfileOptions", "arg*", "options") // Fix interface names - .Rename("ISentrySerializable", "SentrySerializable") - .Rename("ISentryRedactOptions", "SentryRedactOptions") + .RenameInterface("ISentrySerializable", "SentrySerializable") + .RenameInterface("ISentryRedactOptions", "SentryRedactOptions") + .RenameBaseType("ISentrySerializable", "SentrySerializable") + .RenameBaseType("ISentryRedactOptions", "SentryRedactOptions") // Rename conflicting SentryRRWebEvent (protocol vs. interface) - .Rename("SentryRRWebEvent", "ISentryRRWebEvent", iface => iface.HasAttribute("Protocol")) + .RenameProtocol("SentryRRWebEvent", "ISentryRRWebEvent") // Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) - .Attribute("SentryBeforeBreadcrumbCallback", "return: NullAllowed") - .Attribute("SentryBeforeSendEventCallback", "return: NullAllowed") - .Attribute("SentryTracesSamplerCallback", "return: NullAllowed") - .Partial("SentryScope") - .Blacklist( - // error CS0246: The type or namespace name 'iOS' could not be found - "iOS", - // error CS0246: The type or namespace name 'Mac' could not be found - "Mac", - // error CS0117: 'PlatformName' does not contain a definition for 'iOSAppExtension' - "Unavailable" - ) - .Blacklist("") - .Blacklist( - // error CS0114: 'SentryXxx.IsEqual(NSObject?)' hides inherited member 'NSObject.IsEqual(NSObject?)'. - "Sentry*.IsEqual", - // error CS0246: The type or namespace name '_NSZone' could not be found - "Sentry*.CopyWithZone", - // SentryEnvelope* is not whitelisted - "PrivateSentrySDKOnly.CaptureEnvelope", - "PrivateSentrySDKOnly.EnvelopeWithData", - "PrivateSentrySDKOnly.StoreEnvelope", - // deprecated - "Sentry*.CaptureUserFeedback" - ) - .Blacklist( - // SentryAppStartMeasurement is not whitelisted - "SentryOnAppStartMeasurementAvailable", - // deprecated - "SentryUserFeedbackConfigurationBlock" - ) - .Blacklist( - // error CS0114: 'SentryXxx.Description' hides inherited member 'NSObject.Description'. - "Sentry*.Description", - // SentryAppStartMeasurement is not whitelisted - "PrivateSentrySDKOnly.*AppStartMeasurement*", - // SentryStructuredLogAttribute is not whitelisted - "SentryLog.Attributes", - // deprecated - "SentryOptions.ConfigureUserFeedback" - ) - .Whitelist( + .WithAttribute("SentryBeforeBreadcrumbCallback", "return: NullAllowed") + .WithAttribute("SentryBeforeSendEventCallback", "return: NullAllowed") + .WithAttribute("SentryTracesSamplerCallback", "return: NullAllowed") + // For PrivateApiDefinitions.cs + .WithModifier("SentryScope", "partial") + // error CS0246: The type or namespace name 'iOS' could not be found + .RemoveAttribute("iOS") + // error CS0246: The type or namespace name 'Mac' could not be found + .RemoveAttribute("Mac") + // error CS0117: 'PlatformName' does not contain a definition for 'iOSAppExtension' + .RemoveAttribute("Unavailable") + // error CS0114: 'SentryXxx.IsEqual(NSObject?)' hides inherited member 'NSObject.IsEqual(NSObject?)'. + .RemoveMethod("Sentry*", "IsEqual") + // error CS0246: The type or namespace name '_NSZone' could not be found + .RemoveMethod("Sentry*", "CopyWithZone") + // SentryEnvelope* is not whitelisted + .RemoveMethod("PrivateSentrySDKOnly", "CaptureEnvelope") + .RemoveMethod("PrivateSentrySDKOnly", "EnvelopeWithData") + .RemoveMethod("PrivateSentrySDKOnly", "StoreEnvelope") + // deprecated + .RemoveMethod("Sentry*", "CaptureUserFeedback") + // SentryAppStartMeasurement is not whitelisted + .RemoveDelegate("SentryOnAppStartMeasurementAvailable") + // deprecated + .RemoveDelegate("SentryUserFeedbackConfigurationBlock") + // error CS0114: 'SentryXxx.Description' hides inherited member 'NSObject.Description'. + .RemoveProperty("Sentry*", "Description") + // SentryAppStartMeasurement is not whitelisted + .RemoveProperty("PrivateSentrySDKOnly", "*AppStartMeasurement*") + // SentryStructuredLogAttribute is not whitelisted + .RemoveProperty("SentryLog", "Attributes") + // deprecated + .RemoveProperty("SentryOptions", "ConfigureUserFeedback") + .KeepInterfaces( "ISentryRRWebEvent", "PrivateSentrySDKOnly", "SentryAttachment", @@ -171,252 +162,230 @@ internal static class FilterExtensions { - public static CompilationUnitSyntax Blacklist( + public static CompilationUnitSyntax KeepInterfaces( this CompilationUnitSyntax root, - params string[] names) where T : SyntaxNode + params string[] names) { var nodes = root.DescendantNodes() - .OfType() - .Where(node => names.Any(node.Matches)); + .OfType() + .Where(node => !names.Any(name => node.Identifier.Matches(name))); return root.RemoveNodes(nodes, SyntaxRemoveOptions.KeepNoTrivia)!; } - public static CompilationUnitSyntax Whitelist( + public static CompilationUnitSyntax WithNamespace( + this CompilationUnitSyntax root, + string name) + { + var node = SyntaxFactory.FileScopedNamespaceDeclaration(SyntaxFactory.ParseName(name)); + return SyntaxFactory.CompilationUnit() + .WithUsings(root.Usings) + .AddMembers(node.WithMembers(root.Members)); + } + + private static CompilationUnitSyntax RemoveByPredicate( this CompilationUnitSyntax root, - params string[] names) where T : SyntaxNode + Func predicate) where T : SyntaxNode { var nodes = root.DescendantNodes() .OfType() - .Where(node => !names.Any(node.Matches)); + .Where(node => predicate(node)); return root.RemoveNodes(nodes, SyntaxRemoveOptions.KeepNoTrivia)!; } - public static CompilationUnitSyntax Namespace( + public static CompilationUnitSyntax RemoveClass( this CompilationUnitSyntax root, string name) { - var node = SyntaxFactory.FileScopedNamespaceDeclaration(SyntaxFactory.ParseName(name)); - return SyntaxFactory.CompilationUnit() - .WithUsings(root.Usings) - .AddMembers(node.WithMembers(root.Members)); + return root.RemoveByPredicate(node => node.Identifier.Matches(name)); } - public static CompilationUnitSyntax Attribute( + public static CompilationUnitSyntax RemoveDelegate( this CompilationUnitSyntax root, - string typeName, - string attributeName) where T : SyntaxNode + string name) { - var nodes = root.DescendantNodes() - .OfType() - .Where(node => node.Matches(typeName) && !node.HasAttribute(attributeName)); + return root.RemoveByPredicate(node => node.Identifier.Matches(name)); + } - var attribute = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(attributeName)); - var attributeList = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(attribute)); + public static CompilationUnitSyntax RemoveAttribute( + this CompilationUnitSyntax root, + string name) + { + return root + .RemoveByPredicate(node => node.Name.Matches(name)) + .RemoveByPredicate(node => node.Attributes.Count == 0); + } - var replacements = nodes.ToDictionary( - node => node, - node => node.WithAttribute(attributeList)); + public static CompilationUnitSyntax RemoveBaseType( + this CompilationUnitSyntax root, + string name) + { + return root + .RemoveByPredicate(node => node.Type.Matches(name)) + .RemoveByPredicate(node => node.Types.Count == 0); + } - return root.ReplaceNodes(replacements.Keys, (orig, _) => replacements[orig]); + public static CompilationUnitSyntax RemoveMethod( + this CompilationUnitSyntax root, + string type, + string name) + { + return root.RemoveByPredicate(node => node.Identifier.Matches(name) && node.HasParent(type)); } - public static CompilationUnitSyntax Model( + public static CompilationUnitSyntax RemoveProperty( this CompilationUnitSyntax root, - string name, - bool isModel = true) + string type, + string name) + { + return root.RemoveByPredicate(node => node.Identifier.Matches(name) && node.HasParent(type)); + } + + public static CompilationUnitSyntax WithAttribute( + this CompilationUnitSyntax root, + string type, + string attribute) { - var node = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() - .FirstOrDefault(node => node.Matches(name) && node.HasAttribute("Protocol")); + .Where(node => node.Identifier.Matches(type) && !node.HasAttribute(attribute)) + .Cast() + .Concat(root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(type) && !node.HasAttribute(attribute))); + return root.ReplaceNodes(nodes, (node, _) => node.WithAttribute(attribute)); + } - if (node == null) - { - return root; - } + public static CompilationUnitSyntax AsInternal( + this CompilationUnitSyntax root, + string name, + string modifier) + { + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(name)); + return root.ReplaceNodes(nodes, (node, _) => node.WithModifier(modifier)); + } - var trivia = SyntaxFactory.TriviaList( - node.GetLeadingTrivia().Where(t => - !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains("[Model]")))); - var result = root.ReplaceNode(node, node.WithLeadingTrivia(trivia)); - return isModel - ? result.Attribute(name, "Model") - : result; + public static CompilationUnitSyntax WithModifier( + this CompilationUnitSyntax root, + string name, + string modifier) + { + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(name)); + return root.ReplaceNodes(nodes, (node, _) => node.WithModifier(modifier)); } - public static CompilationUnitSyntax BaseType( + public static CompilationUnitSyntax VerifyModel( + this CompilationUnitSyntax root, + string name) + { + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(name) && node.HasAttribute("Protocol")); + return root.ReplaceNodes(nodes, (node, _) => node.WithAttribute("Model").RemoveComment("[Model]")); + } + + public static CompilationUnitSyntax RemoveComment( this CompilationUnitSyntax root, string name, - string baseType) + string comment) { - return root.Attribute(name, $"BaseType (typeof({baseType}))"); + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(name) && node.HasComment(comment)); + return root.ReplaceNodes(nodes, (node, _) => node.RemoveComment(comment)); } - public static CompilationUnitSyntax Rename( + public static CompilationUnitSyntax RenameBaseType( this CompilationUnitSyntax root, - string oldName, - string newName, - Func? predicate = null) where T : SyntaxNode + string from, + string to) { - var nodes = new Dictionary(); - foreach (var node in root.DescendantNodes().OfType()) - { - if (predicate != null && !predicate(node)) - { - continue; - } - - if (node.Matches(oldName)) - { - nodes[node] = node.WithIdentifier(newName); - } - } - return root.ReplaceNodes(nodes.Keys, (orig, _) => nodes[orig]); + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Type.Matches(from)); + return root.ReplaceNodes(nodes, (node, _) => node.WithType(SyntaxFactory.ParseTypeName(to))); } - public static CompilationUnitSyntax Partial( + public static CompilationUnitSyntax RenameInterface( this CompilationUnitSyntax root, - string name) + string from, + string to) { - var node = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() - .FirstOrDefault(i => i.Matches(name)); + .Where(node => node.Identifier.Matches(from)); + return root.ReplaceNodes(nodes, (node, _) => node.WithIdentifier(SyntaxFactory.Identifier(to))); + } - if (node == null) - { - return root; - } + public static CompilationUnitSyntax RenameProtocol( + this CompilationUnitSyntax root, + string from, + string to) + { + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(from) && node.HasAttribute("Protocol")); + return root.ReplaceNodes(nodes, (node, _) => node.WithIdentifier(SyntaxFactory.Identifier(to))); + } - return root.ReplaceNode( - node, - node.AddModifiers(SyntaxFactory.Token(SyntaxKind.PartialKeyword).WithTrailingTrivia(SyntaxFactory.Space)) - ); + public static CompilationUnitSyntax RenameParameter( + this CompilationUnitSyntax root, + string type, + string from, + string to) + { + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(from) && node.Type?.Matches(type) == true); + return root.ReplaceNodes(nodes, (node, _) => node.WithIdentifier(SyntaxFactory.Identifier(to))); } - public static CompilationUnitSyntax PropertyToMethod(this CompilationUnitSyntax root, string pattern) + public static CompilationUnitSyntax PropertyToMethod( + this CompilationUnitSyntax root, + string type, + string name) { - var properties = root.DescendantNodes() + var nodes = root.DescendantNodes() .OfType() - .Where(prop => - prop.AttributeLists.SelectMany(a => a.Attributes) - .Any(attr => attr.Name.ToString() == "Verify" && attr.ArgumentList?.Arguments.ToString().Contains("MethodToProperty") == true) && - prop.AccessorList != null && - prop.AccessorList.Accessors.Count == 1 && - prop.AccessorList.Accessors[0].Kind() == SyntaxKind.GetAccessorDeclaration && - prop.GetQualifiedName().Matches(pattern) - ); - - return root.ReplaceNodes(properties, (original, _) => + .Where(node => node.Identifier.Matches(name) && node.HasParent(type) && node.HasAttribute("Verify", "MethodToProperty")); + return root.ReplaceNodes(nodes, (node, _) => { - var newAttributes = SyntaxFactory.List( - original.AttributeLists - .Select(al => al.WithAttributes( - SyntaxFactory.SeparatedList( - al.Attributes.Where(attr => - !(attr.Name.ToString() == "Verify" && attr.ArgumentList?.Arguments.ToString().Contains("MethodToProperty") == true) - ) - ) - )) - .Where(al => al.Attributes.Count > 0) - ); - - return SyntaxFactory.MethodDeclaration(original.Type, SyntaxFactory.Identifier(original.Identifier.Text)) - .WithModifiers(original.Modifiers) - .WithAttributeLists(newAttributes) + var attributes = node.AttributeLists.RemoveAttribute("Verify", "MethodToProperty"); + return SyntaxFactory.MethodDeclaration(node.Type, SyntaxFactory.Identifier(node.Identifier.Text)) + .WithModifiers(node.Modifiers) + .WithAttributeLists(attributes) .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); }); } - public static CompilationUnitSyntax Verify( + public static CompilationUnitSyntax VerifyProperty( this CompilationUnitSyntax root, - string typeName, - string verify) where T : MemberDeclarationSyntax - { - return root.ReplaceNodes( - root.DescendantNodes().OfType().Where(node => node.Matches(typeName)), - (original, _) => - { - var newAttrLists = original.AttributeLists - .Select(al => al.WithAttributes( - SyntaxFactory.SeparatedList( - al.Attributes.Where(attr => - !(attr.Name.ToString() == "Verify" && - attr.ArgumentList != null && - attr.ArgumentList.Arguments.ToString().Matches(verify)) - ) - ) - )) - .Where(al => al.Attributes.Count > 0); - - return original.WithAttributeLists(SyntaxFactory.List(newAttrLists)); - }); - } - - public static CompilationUnitSyntax Access( - this CompilationUnitSyntax root, - string name, - SyntaxKind modifier) where T : MemberDeclarationSyntax + string type, + string property, + string verify) { - var nodes = root.DescendantNodes().OfType() - .Where(node => node.Matches(name)); - - return root.ReplaceNodes(nodes, (original, _) => - original.WithModifiers(SyntaxFactory.TokenList(SyntaxFactory.Token(modifier))) - ); + var nodes = root.DescendantNodes() + .OfType() + .Where(node => node.Identifier.Matches(property) && node.HasParent(type)); + return root.ReplaceNodes(nodes, (node, _) => node.WithAttributeLists(node.AttributeLists.RemoveAttribute("Verify", verify))); } } internal static class SyntaxNodeExtensions { - public static string GetIdentifier(this SyntaxNode node) + public static bool HasParent(this SyntaxNode node, string name) { - return node switch - { - BaseTypeDeclarationSyntax type => type.Identifier.Text, - DelegateDeclarationSyntax del => del.Identifier.Text, - MethodDeclarationSyntax method => method.Identifier.Text, - PropertyDeclarationSyntax property => property.Identifier.Text, - ParameterSyntax param => $"{param.Type} {param.Identifier.Text}", - AttributeSyntax attr => attr.Name.ToString(), - AttributeListSyntax list => string.Join(" ", list.Attributes.Select(a => a.Name.ToString())), - BaseTypeSyntax type => type.Type.ToString(), - BaseListSyntax list => string.Join(" ", list.Types.Select(t => t.Type.ToString())), - _ => throw new NotSupportedException(node.GetType().Name) - }; + return node.Parent is TypeDeclarationSyntax parent && parent.Identifier.Matches(name); } - public static SyntaxNode WithIdentifier(this SyntaxNode node, string newName) + public static bool HasAttribute(this SyntaxNode node, string attribute, string? arguments = null) { - if (node is ParameterSyntax param) - { - var parts = newName.Trim().Split(' ', 2, StringSplitOptions.RemoveEmptyEntries); - var newType = parts.Length > 1 ? parts[0] : param.Type?.ToString(); - var newParamName = parts.Length > 1 ? parts[1] : parts[0]; - - var updated = param; - if (newType != null && newType != param.Type?.ToString()) - { - updated = updated.WithType(SyntaxFactory.ParseTypeName(newType)); - } - if (newParamName != param.Identifier.Text) - { - updated = updated.WithIdentifier(SyntaxFactory.Identifier(newParamName)); - } - return updated; - } - - var newIdentifier = SyntaxFactory.Identifier(newName); - return node switch - { - InterfaceDeclarationSyntax iface => iface.WithIdentifier(newIdentifier), - ClassDeclarationSyntax cls => cls.WithIdentifier(newIdentifier), - StructDeclarationSyntax str => str.WithIdentifier(newIdentifier), - EnumDeclarationSyntax enm => enm.WithIdentifier(newIdentifier), - DelegateDeclarationSyntax del => del.WithIdentifier(newIdentifier), - MethodDeclarationSyntax method => method.WithIdentifier(newIdentifier), - PropertyDeclarationSyntax property => property.WithIdentifier(newIdentifier), - SimpleBaseTypeSyntax type => type.WithType(SyntaxFactory.ParseTypeName(newName)), - _ => throw new NotSupportedException(node.GetType().Name) - }; + return node.GetAttributes() + .SelectMany(al => al.Attributes) + .Any(attr => attr.Name.Matches(attribute) && (arguments == null || attr.ArgumentList?.Arguments.ToString().Contains(arguments) == true)); } public static SyntaxList GetAttributes(this SyntaxNode node) @@ -431,8 +400,9 @@ public static SyntaxList GetAttributes(this SyntaxNode node }; } - public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax attributeList) + public static SyntaxNode WithAttribute(this SyntaxNode node, string attribute) { + var attributes = SyntaxFactory.AttributeList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(attribute)))); var existingAttributes = node.GetAttributes(); var add = new Func((n, attr) => n switch { @@ -445,79 +415,85 @@ public static SyntaxNode WithAttribute(this SyntaxNode node, AttributeListSyntax if (existingAttributes.Count > 0) { - return add(node, attributeList); + return add(node, attributes); } - return add(node.WithLeadingTrivia(SyntaxFactory.TriviaList()), attributeList.WithLeadingTrivia(node.GetLeadingTrivia())); + return add(node.WithLeadingTrivia(SyntaxFactory.TriviaList()), attributes.WithLeadingTrivia(node.GetLeadingTrivia())); } - public static string GetQualifiedName(this SyntaxNode node) + public static SyntaxNode WithModifier(this SyntaxNode node, string modifier) { - var identifier = node.GetIdentifier(); - var parent = node.Parent; - while (parent != null) + var modifiers = SyntaxFactory.TokenList(SyntaxFactory.ParseToken(modifier)); + return node switch { - if (parent is TypeDeclarationSyntax typeDecl) - { - return $"{typeDecl.Identifier.Text}.{identifier}"; - } - parent = parent.Parent; - } - return identifier; + InterfaceDeclarationSyntax iface => iface.WithModifiers(modifiers), + EnumDeclarationSyntax enm => enm.WithModifiers(modifiers), + _ => throw new NotSupportedException(node.GetType().Name) + }; } - public static bool Matches(this SyntaxNode node, string pattern) + public static bool HasComment(this SyntaxNode node, string comment) { - var actualPattern = pattern.TrimStart('!'); - if (node.GetIdentifier().Matches(actualPattern) || node.GetQualifiedName().Matches(actualPattern)) - { - return !pattern.StartsWith('!'); - } - return false; + var trivia = node.GetLeadingTrivia(); + return trivia.Any(t => + t.IsKind(SyntaxKind.MultiLineCommentTrivia) && + t.ToString().Contains(comment)); } - public static bool HasAttribute(this SyntaxNode node, string attributeName) + public static SyntaxNode RemoveComment(this SyntaxNode node, string comment) { - return node switch - { - InterfaceDeclarationSyntax iface => iface.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - ClassDeclarationSyntax cls => cls.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - StructDeclarationSyntax str => str.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - EnumDeclarationSyntax enm => enm.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - MethodDeclarationSyntax method => method.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - PropertyDeclarationSyntax property => property.AttributeLists - .SelectMany(al => al.Attributes) - .Any(attr => attr.Name.ToString() == attributeName), - _ => false - }; + var trivia = SyntaxFactory.TriviaList( + node.GetLeadingTrivia().Where(t => + !(t.IsKind(SyntaxKind.MultiLineCommentTrivia) && t.ToString().Contains(comment)))); + return node.WithLeadingTrivia(trivia); + } +} + +internal static class AttributeListExtensions +{ + public static SyntaxList RemoveAttribute(this SyntaxList lists, string attribute, string? arguments = null) + { + var attributes = lists + .Select(al => al.WithAttributes( + SyntaxFactory.SeparatedList(al.Attributes.Where(attr => !(attr.Name.ToString() == attribute && (arguments == null || attr.ArgumentList?.Arguments.ToString().Contains(arguments) == true)))) + )) + .Where(al => al.Attributes.Count > 0); + return SyntaxFactory.List(attributes); } } -internal static class StringExtensions +internal static class WildcardExtensions { + public static bool Matches(this NameSyntax syntax, string pattern) + { + return syntax.ToString().Matches(pattern); + } + + public static bool Matches(this TypeSyntax syntax, string pattern) + { + return syntax.ToString().Matches(pattern); + } + + public static bool Matches(this SyntaxToken token, string pattern) + { + return token.Text.Matches(pattern); + } + public static bool Matches(this string str, string pattern) { - if (pattern == str) + var negate = pattern.StartsWith('!'); + var actual = pattern.TrimStart('!'); + if (actual == str) { - return true; + return !negate; } if (!pattern.Contains('*') && !pattern.Contains('?')) { - return false; + return negate; } var regex = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", "."); - return Regex.IsMatch(str, $"^{regex}$"); + return Regex.IsMatch(str, $"^{regex}$") != negate; } } From a1d4b66fcb34d336ebea03ab7a25eca9179781e9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 31 Oct 2025 10:51:52 +0100 Subject: [PATCH 34/36] Prepare KeepMethod/Properties for V9 --- scripts/patch-cocoa-bindings.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 8c8d696135..252a70b690 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -232,6 +232,14 @@ public static CompilationUnitSyntax RemoveMethod( return root.RemoveByPredicate(node => node.Identifier.Matches(name) && node.HasParent(type)); } + public static CompilationUnitSyntax KeepMethods( + this CompilationUnitSyntax root, + string type, + params string[] names) + { + return root.RemoveByPredicate(node => !names.Any(name => node.Identifier.Matches(name)) && node.HasParent(type)); + } + public static CompilationUnitSyntax RemoveProperty( this CompilationUnitSyntax root, string type, @@ -240,6 +248,14 @@ public static CompilationUnitSyntax RemoveProperty( return root.RemoveByPredicate(node => node.Identifier.Matches(name) && node.HasParent(type)); } + public static CompilationUnitSyntax KeepProperties( + this CompilationUnitSyntax root, + string type, + params string[] names) + { + return root.RemoveByPredicate(node => !names.Any(name => node.Identifier.Matches(name)) && node.HasParent(type)); + } + public static CompilationUnitSyntax WithAttribute( this CompilationUnitSyntax root, string type, From 857f79303f18f164df9a1780870f0fefc5c00493 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 31 Oct 2025 14:03:20 +0100 Subject: [PATCH 35/36] Fix WildcardExtensions.Matches --- scripts/patch-cocoa-bindings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/patch-cocoa-bindings.cs b/scripts/patch-cocoa-bindings.cs index 252a70b690..70b544901c 100644 --- a/scripts/patch-cocoa-bindings.cs +++ b/scripts/patch-cocoa-bindings.cs @@ -504,12 +504,12 @@ public static bool Matches(this string str, string pattern) return !negate; } - if (!pattern.Contains('*') && !pattern.Contains('?')) + if (!actual.Contains('*') && !actual.Contains('?')) { return negate; } - var regex = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", "."); + var regex = Regex.Escape(actual).Replace("\\*", ".*").Replace("\\?", "."); return Regex.IsMatch(str, $"^{regex}$") != negate; } } From 32714c044ad9fadefcd36a4b40bf624406fb899f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 31 Oct 2025 14:14:17 +0100 Subject: [PATCH 36/36] $PSNativeCommandUseErrorActionPreference = $true --- scripts/generate-cocoa-bindings.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index 212c08f4d9..38b5eae0a2 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -2,6 +2,7 @@ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' +$PSNativeCommandUseErrorActionPreference = $true $RootPath = (Get-Item $PSScriptRoot).Parent.FullName $CocoaSdkPath = "$RootPath/modules/sentry-cocoa"