├── .assets
├── sentry-nuget.png
└── sentry-wordmark-dark-280x84.png
├── .craft.yml
├── .gitattributes
├── .github
├── after_01.png
├── after_02.png
├── before_01.png
├── before_02.png
├── device_info.png
├── device_info_02.png
├── sample
│ ├── android_phone.png
│ ├── android_wear.png
│ ├── ios.png
│ └── uwp.png
├── setup_droid.png
├── setup_ios.png
└── workflows
│ ├── add-platform-label.yml
│ ├── build.yaml
│ ├── danger.yml
│ └── release.yml
├── .gitignore
├── CHANGELOG.md
├── Directory.Build.props
├── README.md
├── Samples
├── Forms
│ └── com.sentry.ovenlibrary
│ │ ├── AndroidProject
│ │ ├── .gitignore
│ │ ├── OvenLibrary
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle
│ │ │ ├── consumer-rules.pro
│ │ │ ├── proguard-rules.pro
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── native-lib.cpp
│ │ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── sentry
│ │ │ │ └── ovenlibrary
│ │ │ │ └── Oven.java
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ ├── gradle-wrapper.properties
│ │ │ │ └── gradlewrappergradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
│ │ ├── Jars
│ │ └── OvenLibrary.aar
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── Transforms
│ │ ├── EnumFields.xml
│ │ ├── EnumMethods.xml
│ │ └── Metadata.xml
│ │ ├── com.sentry.ovenlibrary.GeneratedMSBuildEditorConfig.editorconfig
│ │ └── com.sentry.ovenlibrary.csproj
├── README.md
├── Sample.Xamarin.Core
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── Behaviors
│ │ ├── BehaviorBase.cs
│ │ └── EventToCommandBehavior.cs
│ ├── CustomControls
│ │ ├── EditorValidation.xaml
│ │ ├── EditorValidation.xaml.cs
│ │ ├── EntryValidation.xaml
│ │ └── EntryValidation.xaml.cs
│ ├── Directory.Build.props
│ ├── Extensions
│ │ └── SentryIdExtensions.cs
│ ├── Interfaces
│ │ ├── INativeCrash.cs
│ │ └── NavigationService.cs
│ ├── Resources
│ │ ├── BrokenSvg.xaml
│ │ ├── BrokenSvg.xaml.cs
│ │ ├── BugSvg.xaml
│ │ ├── BugSvg.xaml.cs
│ │ ├── DiscoSvg.xaml
│ │ ├── DiscoSvg.xaml.cs
│ │ ├── FeedbackSvg.xaml
│ │ ├── FeedbackSvg.xaml.cs
│ │ ├── PopupSvg.xaml
│ │ ├── PopupSvg.xaml.cs
│ │ ├── UnhandledSvg.xaml
│ │ └── UnhandledSvg.xaml.cs
│ ├── Rules
│ │ └── ExtendedBindableObject.cs
│ ├── Sample.Xamarin.Core.csproj
│ ├── Services
│ │ └── AuthService.cs
│ ├── ViewModels
│ │ ├── DiscoPageViewModel.cs
│ │ ├── LoginPageViewModel.cs
│ │ ├── MainPageViewModel.cs
│ │ └── Popups
│ │ │ ├── AboutPagePopupPageViewModel.cs
│ │ │ └── UserFeedbackPopupPageViewModel.cs
│ ├── Views
│ │ ├── DiscoPage.xaml
│ │ ├── DiscoPage.xaml.cs
│ │ ├── LoginPage.xaml
│ │ ├── LoginPage.xaml.cs
│ │ ├── MainPage.xaml
│ │ ├── MainPage.xaml.cs
│ │ └── Popups
│ │ │ ├── AboutPopupPage.xaml
│ │ │ ├── AboutPopupPage.xaml.cs
│ │ │ ├── PaymentPopupPage.xaml
│ │ │ ├── PaymentPopupPage.xaml.cs
│ │ │ ├── UserFeedbackPopupPage.xaml
│ │ │ └── UserFeedbackPopupPage.xaml.cs
│ ├── XamlPageWithIssue.xaml
│ └── XamlPageWithIssue.xaml.cs
├── Sample.Xamarin.Droid
│ ├── Assets
│ │ └── AboutAssets.txt
│ ├── Dependencies
│ │ └── NativeCrash.cs
│ ├── Directory.Build.props
│ ├── MainActivity.cs
│ ├── Properties
│ │ ├── AndroidManifest.xml
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── AboutResources.txt
│ │ ├── drawable-hdpi
│ │ │ └── splashscreen_img.jpg
│ │ ├── drawable-mdpi
│ │ │ └── splashscreen_img.jpg
│ │ ├── drawable-xhdpi
│ │ │ └── splashscreen_img.jpg
│ │ ├── drawable-xxhdpi
│ │ │ └── splashscreen_img.jpg
│ │ ├── drawable-xxxhdpi
│ │ │ └── splashscreen_img.jpg
│ │ ├── drawable
│ │ │ ├── disco_light.gif
│ │ │ ├── login_background_logo.png
│ │ │ └── login_background_top.png
│ │ ├── layout
│ │ │ ├── Tabbar.xml
│ │ │ └── Toolbar.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── icon.xml
│ │ │ └── icon_round.xml
│ │ ├── mipmap-hdpi
│ │ │ ├── icon.png
│ │ │ └── launcher_foreground.png
│ │ ├── mipmap-mdpi
│ │ │ ├── icon.png
│ │ │ └── launcher_foreground.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── icon.png
│ │ │ └── launcher_foreground.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── icon.png
│ │ │ └── launcher_foreground.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── icon.png
│ │ │ └── launcher_foreground.png
│ │ └── values
│ │ │ ├── colors.xml
│ │ │ └── styles.xml
│ ├── Sample.Xamarin.Droid.csproj
│ └── SplashActivity.cs
├── Sample.Xamarin.Mac
│ ├── AppDelegate.cs
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── AppIcon-128.png
│ │ │ ├── AppIcon-128@2x.png
│ │ │ ├── AppIcon-16.png
│ │ │ ├── AppIcon-16@2x.png
│ │ │ ├── AppIcon-256.png
│ │ │ ├── AppIcon-256@2x.png
│ │ │ ├── AppIcon-32.png
│ │ │ ├── AppIcon-32@2x.png
│ │ │ ├── AppIcon-512.png
│ │ │ ├── AppIcon-512@2x.png
│ │ │ └── Contents.json
│ │ └── Contents.json
│ ├── Directory.Build.props
│ ├── Entitlements.plist
│ ├── Info.plist
│ ├── Main.cs
│ ├── Main.storyboard
│ ├── Sample.Xamarin.Mac.csproj
│ ├── SampleView.cs
│ ├── SampleViewController.cs
│ ├── SampleWindow.cs
│ └── SampleWindowController.cs
├── Sample.Xamarin.UWP
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ └── sentry-glyph-light-48x48.png
│ ├── Directory.Build.props
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── Sample.Xamarin.UWP.GeneratedMSBuildEditorConfig.editorconfig
│ ├── Sample.Xamarin.UWP.csproj
│ ├── disco_light.gif
│ ├── login_background_logo.png
│ └── login_background_top.png
└── Sample.Xamarin.iOS
│ ├── AppDelegate.cs
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon1024.png
│ │ ├── Icon120.png
│ │ ├── Icon152.png
│ │ ├── Icon167.png
│ │ ├── Icon180.png
│ │ ├── Icon20.png
│ │ ├── Icon29.png
│ │ ├── Icon40.png
│ │ ├── Icon58.png
│ │ ├── Icon60.png
│ │ ├── Icon76.png
│ │ ├── Icon80.png
│ │ └── Icon87.png
│ ├── Dependencies
│ └── NativeCrash.cs
│ ├── Directory.Build.props
│ ├── Entitlements.plist
│ ├── Info.plist
│ ├── Main.cs
│ ├── PrivacyInfo.xcprivacy
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── Default-Portrait.png
│ ├── Default-Portrait@2x.png
│ ├── Default.png
│ ├── Default@2x.png
│ ├── LaunchScreen.storyboard
│ ├── disco_light.gif
│ ├── login_background_logo.png
│ └── login_background_top.png
│ ├── Sample.Xamarin.iOS.GeneratedMSBuildEditorConfig.editorconfig
│ └── Sample.Xamarin.iOS.csproj
├── Sentry.Xamarin-CI-Build-Windows.slnf
├── Sentry.Xamarin-CI-Build-macOS.slnf
├── Sentry.Xamarin.sln
├── Src
├── Directory.Build.props
├── Sentry.Xamarin.Forms
│ ├── Extensibility
│ │ └── DisabledNavigationPage.cs
│ ├── Extensions
│ │ ├── PageExtensions.cs
│ │ ├── SentryXamarinFormsIntegrationExtensions.cs
│ │ └── SentryXamarinOptionsExtensions.cs
│ ├── Internals
│ │ ├── FormsApplicationListener.cs
│ │ ├── FormsNavigationIntegration.cs
│ │ ├── PageInfo.cs
│ │ └── SentryXamarinFormsIntegration.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Sentry.Xamarin.Forms.csproj
└── Sentry.Xamarin
│ ├── Extensions
│ ├── IHubExtensions.cs
│ ├── SentryXamarinOptionsExtensions.cs
│ └── StringExtensions.cs
│ ├── Internals
│ ├── Device
│ │ └── Screenshot
│ │ │ ├── ScreenshotAttachment.cs
│ │ │ └── ScreenshotAttachmentContent.cs
│ ├── DeviceModel.ios.cs
│ ├── DeviceModel.mac.cs
│ ├── IPageNavigationTracker.cs
│ ├── NativeEventProcessor.droid.cs
│ ├── NativeEventProcessor.ios.cs
│ ├── NativeEventProcessor.mac.cs
│ ├── NativeEventProcessor.uwp.cs
│ ├── NativeExceptionProcessor.ios.cs
│ ├── NativeExceptionProcessor.mac.cs
│ ├── NativeIntegration.droid.cs
│ ├── NativeIntegration.ios.cs
│ ├── NativeIntegration.mac.cs
│ ├── NativeIntegration.uwp.cs
│ ├── NativeStackTraceFactory.ios.mac.cs
│ ├── SentryAndroidHelpers.droid.cs
│ ├── Session
│ │ ├── DeviceActiveLogger.droid.cs
│ │ ├── DeviceActiveLogger.ios.uwp.cs
│ │ └── IDeviceActiveLogger.cs
│ └── XamarinEventProcessor.cs
│ ├── Privacy
│ └── SentryPrivacyInfo.xcprivacy
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Sentry.Xamarin.csproj
│ ├── SentryXamarin.cs
│ ├── SentryXamarinOptions.cs
│ └── buildTransitive
│ └── Sentry.Xamarin.targets
├── Tests
├── Sentry.Xamarin.Forms.Testing
│ ├── ExpectedOSNames.cs
│ ├── Mock
│ │ ├── MockDiagnosticLogger.cs
│ │ └── MockHub.cs
│ └── Sentry.Xamarin.Forms.Testing.csproj
├── Sentry.Xamarin.Forms.UWP.Tests
│ ├── Assets
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ ├── StoreLogo.png
│ │ └── Wide310x150Logo.scale-200.png
│ ├── Extensions
│ │ └── SentryXamarinOptionsExtensionsTests.cs
│ ├── Internals
│ │ ├── FormsApplicationListenerTests.cs
│ │ ├── NativeEventProcessorTests.cs
│ │ ├── NativeIntegrationTests.cs
│ │ └── XamarinEventProcessorTests.cs
│ ├── Package.appxmanifest
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── Sentry.Xamarin.Forms.Tests.UWP.GeneratedMSBuildEditorConfig.editorconfig
│ ├── Sentry.Xamarin.Forms.UWP.Tests.GeneratedMSBuildEditorConfig.editorconfig
│ ├── Sentry.Xamarin.Forms.UWP.Tests.csproj
│ ├── SentryXamarinIntegrationTests.cs
│ ├── UnitTestApp.xaml
│ └── UnitTestApp.xaml.cs
└── Sentry.Xamarin.Tests
│ ├── Extensions
│ ├── IHubExtensionsTests.cs
│ └── SentryXamarinOptionsExtensionsTests.cs
│ └── Sentry.Xamarin.Tests.csproj
├── dangerfile.js
└── scripts
├── bump-version.ps1
├── bump-version.sh
└── install-win-sdk.ps1
/.assets/sentry-nuget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.assets/sentry-nuget.png
--------------------------------------------------------------------------------
/.assets/sentry-wordmark-dark-280x84.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.assets/sentry-wordmark-dark-280x84.png
--------------------------------------------------------------------------------
/.craft.yml:
--------------------------------------------------------------------------------
1 | minVersion: 0.23.1
2 | changelogPolicy: auto
3 | targets:
4 | - name: nuget
5 | - name: github
6 | - name: registry
7 | sdks:
8 | nuget:Sentry.Xamarin:
9 | nuget:Sentry.Xamarin.Forms:
10 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/after_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/after_01.png
--------------------------------------------------------------------------------
/.github/after_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/after_02.png
--------------------------------------------------------------------------------
/.github/before_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/before_01.png
--------------------------------------------------------------------------------
/.github/before_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/before_02.png
--------------------------------------------------------------------------------
/.github/device_info.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/device_info.png
--------------------------------------------------------------------------------
/.github/device_info_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/device_info_02.png
--------------------------------------------------------------------------------
/.github/sample/android_phone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/sample/android_phone.png
--------------------------------------------------------------------------------
/.github/sample/android_wear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/sample/android_wear.png
--------------------------------------------------------------------------------
/.github/sample/ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/sample/ios.png
--------------------------------------------------------------------------------
/.github/sample/uwp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/sample/uwp.png
--------------------------------------------------------------------------------
/.github/setup_droid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/setup_droid.png
--------------------------------------------------------------------------------
/.github/setup_ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/.github/setup_ios.png
--------------------------------------------------------------------------------
/.github/workflows/add-platform-label.yml:
--------------------------------------------------------------------------------
1 | name: Add Platform Label
2 | on:
3 | issues:
4 | types: [opened]
5 | pull_request:
6 | types: [opened]
7 |
8 | jobs:
9 | add_label:
10 | runs-on: ubuntu-latest
11 | permissions:
12 | issues: write
13 | steps:
14 | - uses: andymckay/labeler@1.0.4
15 | with:
16 | add-labels: "Platform: Xamarin"
17 | repo-token: ${{ secrets.GITHUB_TOKEN }}
18 |
--------------------------------------------------------------------------------
/.github/workflows/build.yaml:
--------------------------------------------------------------------------------
1 | name: build
2 | on:
3 | push:
4 | tags:
5 | - 'v*.*.*'
6 | branches:
7 | - main
8 | - release/*
9 |
10 | pull_request:
11 | jobs:
12 | build:
13 | name: ${{ matrix.os }}
14 | runs-on: ${{ matrix.os }}
15 |
16 | strategy:
17 | fail-fast: false
18 | matrix:
19 | os: [windows-latest, macos-13]
20 | steps:
21 | - uses: actions/checkout@v4
22 | - uses: microsoft/setup-msbuild@v1.1
23 | if: startsWith(matrix.os, 'windows')
24 | # By default, the latest Windows machine doesn't come with the 16299 SDK installed,
25 | # which is required for building the UWP platform.
26 | - name: Install Windows SDK Version 10.0.16299.0
27 | run:
28 | pwsh ./scripts/install-win-sdk.ps1 16299
29 | if: startsWith(matrix.os, 'windows')
30 |
31 | # Setup Xamarin SDK that got removed on the latest MacOS VM
32 | - name: Setup Xamarin MacOS SDK
33 | if: startsWith(matrix.os, 'macos')
34 | run: |
35 | brew tap homebrew/cask-versions
36 | brew install --cask xamarin-mac
37 | - name: Setup Xamarin Android SDK
38 | if: startsWith(matrix.os, 'macos')
39 | run: brew install --cask xamarin-android
40 | - name: Setup Xamarin iOS SDK
41 | if: startsWith(matrix.os, 'macos')
42 | run: brew install --cask xamarin-ios
43 |
44 | - name: Setup Java SDK
45 | uses: actions/setup-java@v4
46 | with:
47 | distribution: 'temurin'
48 | java-version: '17'
49 |
50 | - name: Setup Android SDK
51 | uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
52 | with:
53 | packages: 'platforms;android-30'
54 |
55 | - run: msbuild Sentry.Xamarin.sln -p:Configuration=Release -t:restore
56 | - name: Build SDK, Sample and Tests
57 | run: msbuild Sentry.Xamarin-CI-Build-${{ runner.os }}.slnf -p:Configuration=Release
58 |
59 | - name: Setup VS Test
60 | uses: darenm/Setup-VSTest@v1
61 | if: startsWith(matrix.os, 'windows')
62 | - name: Artifacts
63 | uses: actions/upload-artifact@v3
64 | with:
65 | name: ${{ github.sha }}
66 | path: |
67 | ${{ github.workspace }}/src/**/Release/*.nupkg
68 |
--------------------------------------------------------------------------------
/.github/workflows/danger.yml:
--------------------------------------------------------------------------------
1 | name: "Danger"
2 | on:
3 | pull_request:
4 | types: [opened, synchronize, reopened, edited, ready_for_review]
5 |
6 | jobs:
7 | build:
8 | name: Changelog
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v3
12 | with:
13 | fetch-depth: 0
14 | - run: npx danger ci
15 | env:
16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 |
18 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | version:
7 | description: Version to release
8 | required: true
9 | force:
10 | description: Force a release even when there are release-blockers (optional)
11 | required: false
12 |
13 | jobs:
14 | job_release:
15 | runs-on: ubuntu-latest
16 | name: 'Release a new version: ${{ github.event.inputs.version }}'
17 | steps:
18 | - name: Get auth token
19 | id: token
20 | uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
21 | with:
22 | app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
23 | private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}
24 |
25 | - name: Check out current commit (${{ github.sha }})
26 | uses: actions/checkout@v4
27 | with:
28 | token: ${{ steps.token.outputs.token }}
29 | fetch-depth: 0
30 |
31 | - name: Prepare release ${{ github.event.inputs.version }}
32 | uses: getsentry/action-prepare-release@v1
33 | env:
34 | GITHUB_TOKEN: ${{ steps.token.outputs.token }}
35 | with:
36 | version: ${{ github.event.inputs.version }}
37 | force: ${{ github.event.inputs.force }}
38 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 2.1.0
5 | latest
6 | true
7 | true
8 | strict
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 30
7 | buildToolsVersion "30.0.3"
8 |
9 | defaultConfig {
10 | minSdkVersion 16
11 | targetSdkVersion 30
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | externalNativeBuild {
18 | cmake {
19 | cppFlags ""
20 | }
21 | }
22 | }
23 |
24 | buildTypes {
25 | release {
26 | minifyEnabled false
27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
28 | }
29 | }
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 | externalNativeBuild {
35 | cmake {
36 | path "src/main/cpp/CMakeLists.txt"
37 | version "3.10.2"
38 | }
39 | }
40 | ndkVersion '21.1.6352462'
41 | }
42 |
43 | dependencies {
44 | implementation 'androidx.appcompat:appcompat:1.2.0'
45 | implementation 'com.google.android.material:material:1.3.0'
46 | testImplementation 'junit:junit:4.+'
47 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
49 | }
50 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/consumer-rules.pro
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/src/main/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10.2)
2 |
3 | project("OvenLibrary")
4 |
5 | add_library(
6 | native-lib
7 | SHARED
8 | native-lib.cpp )
9 |
10 |
11 | find_library( # Sets the name of the path variable.
12 | log-lib
13 | log )
14 |
15 | target_link_libraries( # Specifies the target library.
16 | native-lib
17 | ${log-lib} )
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/src/main/cpp/native-lib.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | extern "C" JNIEXPORT jstring JNICALL Java_com_sentry_ovenlibrary_Oven_Cook( JNIEnv * env, jobject obj) {
6 | std::string hello = "Hello from C++";
7 | char *ptr = 0;
8 | *ptr += 1;
9 | return env->NewStringUTF(hello.c_str());
10 | }
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/OvenLibrary/src/main/java/com/sentry/ovenlibrary/Oven.java:
--------------------------------------------------------------------------------
1 | package com.sentry.ovenlibrary;
2 |
3 | public class Oven {
4 | static {
5 | System.loadLibrary("native-lib");
6 | }
7 |
8 | public native String Cook();
9 | }
10 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath "com.android.tools.build:gradle:4.1.2"
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | google()
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/gradle/wrapper/gradlewrappergradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
2 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/AndroidProject/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':OvenLibrary'
2 | rootProject.name = "Oven"
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/Jars/OvenLibrary.aar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Forms/com.sentry.ovenlibrary/Jars/OvenLibrary.aar
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("com.sentry.ovenlibrary")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("com.sentry.ovenlibrary")]
14 | [assembly: AssemblyCopyright("Copyright © 2021")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | [assembly: AssemblyVersion("1.0.0.0")]
26 | [assembly: AssemblyFileVersion("1.0.0.0")]
27 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/Transforms/EnumFields.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/Transforms/EnumMethods.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/Transforms/Metadata.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/com.sentry.ovenlibrary.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework =
3 | build_property.TargetPlatformMinVersion =
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids = {10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
6 | build_property.PublishSingleFile =
7 | build_property.IncludeAllContentForSelfExtract =
8 | build_property._SupportedPlatformList =
9 |
--------------------------------------------------------------------------------
/Samples/Forms/com.sentry.ovenlibrary/com.sentry.ovenlibrary.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | 8.0.30703
7 | 2.0
8 | {4DA5AECE-3A16-45AE-9C6D-45B262236175}
9 | {10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | {77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}
11 | Library
12 | Properties
13 | com.sentry.ovenlibrary
14 | com.sentry.ovenlibrary
15 | 512
16 | True
17 | v9.0
18 | class-parse
19 | XAJavaInterop1
20 | PackageReference
21 |
22 |
23 | true
24 | portable
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE
28 | prompt
29 | 4
30 |
31 |
32 | portable
33 | true
34 | bin\Release\
35 | TRACE
36 | prompt
37 | 4
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/Samples/README.md:
--------------------------------------------------------------------------------
1 | ### Sample Xamarin.Forms app for iOS, Android and Windows
2 |
3 |
4 |
5 |
6 |
7 |  |
8 |  |
9 |  |
10 |  |
11 |
12 |
13 | Android Wear |
14 | Android Phone/Tablet |
15 | UWP |
16 | iOS |
17 |
18 |
19 |
20 |
21 | ## Requirements:
22 | - Microsoft Visual Studio 2019 (Windows)
23 | - Microsoft Visual Studio for Mac (Mac)
24 | - Windows 10 1809 or higher (for UWP)
25 |
26 | ## About
27 |
28 | This demo demonstrates a complete working app where the main features of Sentry are shown. Those are:
29 | - Error Capturing.
30 | - Unhandled Error Capture.
31 | - Breadcrumbs
32 | - User Feedback.
33 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Sample.Xamarin.Core.Views;
2 | using Xamarin.Forms;
3 |
4 | namespace Sample.Xamarin.Core
5 | {
6 | public partial class App : Application
7 | {
8 | public App()
9 | {
10 | InitializeComponent();
11 | MainPage = new LoginPage();
12 | }
13 |
14 | protected override void OnStart()
15 | {
16 | base.OnStart();
17 | }
18 | protected override void OnSleep()
19 | {
20 | base.OnSleep();
21 | }
22 | protected override void OnResume()
23 | {
24 | base.OnResume();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms.Xaml;
2 |
3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Behaviors/BehaviorBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Forms;
3 |
4 | namespace Sample.Xamarin.Core.Behaviors
5 | {
6 | public class BehaviorBase : Behavior where T : BindableObject
7 | {
8 | public T AssociatedObject { get; private set; }
9 |
10 | protected override void OnAttachedTo(T bindable)
11 | {
12 | base.OnAttachedTo(bindable);
13 | AssociatedObject = bindable;
14 |
15 | if (bindable.BindingContext != null)
16 | {
17 | BindingContext = bindable.BindingContext;
18 | }
19 |
20 | bindable.BindingContextChanged += OnBindingContextChanged;
21 | }
22 |
23 | protected override void OnDetachingFrom(T bindable)
24 | {
25 | base.OnDetachingFrom(bindable);
26 | bindable.BindingContextChanged -= OnBindingContextChanged;
27 | AssociatedObject = null;
28 | }
29 |
30 | void OnBindingContextChanged(object sender, EventArgs e)
31 | {
32 | OnBindingContextChanged();
33 | }
34 |
35 | protected override void OnBindingContextChanged()
36 | {
37 | base.OnBindingContextChanged();
38 | BindingContext = AssociatedObject.BindingContext;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/CustomControls/EditorValidation.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/CustomControls/EntryValidation.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Extensions/SentryIdExtensions.cs:
--------------------------------------------------------------------------------
1 | using Sentry;
2 | using System;
3 | //Based on https://github.com/csharpvitamins/CSharpVitamins.ShortGuid
4 |
5 | namespace Sample.Xamarin.Core.Extensions
6 | {
7 | public static class SentryIdExtensions
8 | {
9 | public static string GetShortId(this SentryId id)
10 | {
11 | if (id.Equals(SentryId.Empty))
12 | {
13 | return null;
14 | }
15 | string encoded = Convert.ToBase64String(((Guid)id).ToByteArray());
16 |
17 | encoded = encoded
18 | .Replace("/", "_")
19 | .Replace("+", "-");
20 |
21 | return encoded.Substring(0, 16);
22 |
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Interfaces/INativeCrash.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Sample.Xamarin.Core.Interfaces
6 | {
7 | public interface INativeCrash
8 | {
9 | void BrokenNativeCallback();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Interfaces/NavigationService.cs:
--------------------------------------------------------------------------------
1 | using Rg.Plugins.Popup.Pages;
2 | using Rg.Plugins.Popup.Services;
3 | using Sample.Xamarin.Core.Rules;
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 | using Xamarin.Forms;
7 |
8 | namespace Sample.Xamarin.Core.Interfaces
9 | {
10 | ///
11 | /// Simple navigation service that hides the direct access to the MainPage for navigation, but also,
12 | /// simplifies passing argument to viewmodels.
13 | ///
14 | public class NavigationService : ExtendedBindableObject
15 | {
16 | public static Task DisplayAlert(string title, string message, string cancel)
17 | => Application.Current.MainPage.DisplayAlert(title, message, cancel);
18 |
19 | public static void ReplacePage(Page page)
20 | {
21 | Application.Current.MainPage = page;
22 | }
23 |
24 | public static void NavigateTo(Page page)
25 | {
26 | Application.Current.MainPage.Navigation.PushAsync(page);
27 | }
28 |
29 | public static Task ShowPopup(PopupPage popup)
30 | => PopupNavigation.Instance.PushAsync(popup);
31 |
32 | public static async Task ShowPopup(PopupPage popup, NavigationService viewModel, Dictionary parameters)
33 | {
34 | await PopupNavigation.Instance.PushAsync(popup);
35 | popup.BindingContext = viewModel;
36 | viewModel.Initialize(parameters);
37 | }
38 |
39 | public static Task ClosePopup()
40 | => PopupNavigation.Instance.PopAsync();
41 |
42 | public virtual void Initialize(Dictionary parameters) { }
43 | }
44 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/BrokenSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/BrokenSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Resources
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class BrokenSvg : ContentView
8 | {
9 | public BrokenSvg()
10 | {
11 | InitializeComponent();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/BugSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/BugSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Xamarin.Forms;
8 | using Xamarin.Forms.Xaml;
9 |
10 | namespace Sample.Xamarin.Core.Resources
11 | {
12 | [XamlCompilation(XamlCompilationOptions.Compile)]
13 | public partial class BugSvg : ContentView
14 | {
15 | public BugSvg()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/DiscoSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/DiscoSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Xamarin.Forms;
8 | using Xamarin.Forms.Xaml;
9 |
10 | namespace Sample.Xamarin.Core.Resources
11 | {
12 | [XamlCompilation(XamlCompilationOptions.Compile)]
13 | public partial class DiscoSvg : ContentView
14 | {
15 | public DiscoSvg()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/FeedbackSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/FeedbackSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | using Xamarin.Forms;
8 | using Xamarin.Forms.Xaml;
9 |
10 | namespace Sample.Xamarin.Core.Resources
11 | {
12 | [XamlCompilation(XamlCompilationOptions.Compile)]
13 | public partial class FeedbackSvg : ContentView
14 | {
15 | public FeedbackSvg()
16 | {
17 | InitializeComponent();
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/PopupSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
16 |
17 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/PopupSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Resources
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class PopupSvg : ContentView
8 | {
9 | public PopupSvg()
10 | {
11 | InitializeComponent();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/UnhandledSvg.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Resources/UnhandledSvg.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Resources
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class UnhandledSvg : ContentView
8 | {
9 | public UnhandledSvg()
10 | {
11 | InitializeComponent();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Rules/ExtendedBindableObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq.Expressions;
3 | using System.Reflection;
4 | using Xamarin.Forms;
5 |
6 | namespace Sample.Xamarin.Core.Rules
7 | {
8 | public class ExtendedBindableObject : BindableObject
9 | {
10 | public void RaisePropertyChanged(Expression> property)
11 | {
12 | var name = GetMemberInfo(property).Name;
13 | OnPropertyChanged(name);
14 | }
15 |
16 | private MemberInfo GetMemberInfo(Expression expression)
17 | {
18 | MemberExpression operand;
19 | LambdaExpression lambdaExpression = (LambdaExpression)expression;
20 | if (lambdaExpression.Body is UnaryExpression)
21 | {
22 | UnaryExpression body = (UnaryExpression)lambdaExpression.Body;
23 | operand = (MemberExpression)body.Operand;
24 | }
25 | else
26 | {
27 | operand = (MemberExpression)lambdaExpression.Body;
28 | }
29 | return operand.Member;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Services/AuthService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Sample.Xamarin.Core.Services
4 | {
5 | public class AuthService
6 | {
7 | public Tuple Authenticate(string login, string password)
8 | => login == password && password == "1234" ? new Tuple(true, null) :
9 | new Tuple(false, "Invalid Login or Password.");
10 |
11 | public void DoLogin(string login, string password)
12 | {
13 | ValidatePassword(login, password);
14 | }
15 |
16 | private bool ValidatePassword(string user, string password)
17 | {
18 | var validation = int.Parse(password) / user.Length;
19 | string notExpected = user;
20 | return validation != int.Parse(notExpected);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/ViewModels/DiscoPageViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Sample.Xamarin.Core.ViewModels
6 | {
7 | class DiscoPageViewModel
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/ViewModels/LoginPageViewModel.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Protocol;
2 | using Sample.Xamarin.Core.Interfaces;
3 | using Sample.Xamarin.Core.Services;
4 | using Sample.Xamarin.Core.Views;
5 | using System;
6 | using Xamarin.Forms;
7 | using Sentry;
8 |
9 | namespace Sample.Xamarin.Core.ViewModels
10 | {
11 | public class LoginPageViewModel : NavigationService
12 | {
13 | private readonly AuthService _authService;
14 | public string Login { get; set; }
15 | public string Password { get; set; }
16 | public Command LoginCmd { get; }
17 |
18 | public LoginPageViewModel()
19 | {
20 | LoginCmd = new Command(LoginAction);
21 | _authService = new AuthService();
22 | }
23 |
24 | internal Action LoginAction => async () =>
25 | {
26 | SentrySdk.AddBreadcrumb("Login", "ui.click", level: BreadcrumbLevel.Info);
27 | var authenticate = _authService.Authenticate(Login, Password);
28 | if (authenticate.Item1)
29 | {
30 | ReplacePage(new NavigationPage(new MainPage())
31 | {
32 | BarBackgroundColor = Color.FromRgb(46, 14, 51)
33 | });
34 | }
35 | else
36 | {
37 | SentrySdk.AddBreadcrumb(authenticate.Item2, "console", level: BreadcrumbLevel.Warning);
38 | await DisplayAlert("warning", authenticate.Item2, "OK");
39 | }
40 | };
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/ViewModels/MainPageViewModel.cs:
--------------------------------------------------------------------------------
1 | using Sample.Xamarin.Core.Interfaces;
2 | using Sample.Xamarin.Core.Services;
3 | using Sample.Xamarin.Core.ViewModels.Popups;
4 | using Sample.Xamarin.Core.Views;
5 | using Sample.Xamarin.Core.Views.Popups;
6 | using System;
7 | using System.Collections.Generic;
8 | using Xamarin.Forms;
9 | using Sentry;
10 |
11 | namespace Sample.Xamarin.Core.ViewModels
12 | {
13 | public class MainPageViewModel : NavigationService
14 | {
15 | private readonly INativeCrash _nativeCrashService;
16 | public Command FeedbackCmd {get;}
17 | public Command HandledCmd { get; }
18 | public Command UnhandledCmd { get; }
19 | public Command DiscoCmd { get; }
20 | public Command PopupCmd { get; }
21 | public Command BrokenViewCmd { get; }
22 | public Command NativeCrashCmd { get; }
23 | public MainPageViewModel()
24 | {
25 | DiscoCmd = new Command(GotoDisco);
26 | PopupCmd = new Command(ShowAboutPopup);
27 | HandledCmd = new Command(DoLogin);
28 | UnhandledCmd = new Command(Unhandle);
29 | BrokenViewCmd = new Command(GotoBrokenView);
30 | FeedbackCmd = new Command(ShowFeedback);
31 | NativeCrashCmd = new Command(NativeCrash);
32 | _nativeCrashService = DependencyService.Get();
33 | }
34 |
35 | private Action GotoDisco => () =>
36 | {
37 | NavigateTo(new DiscoPage());
38 | };
39 |
40 | private Action GotoBrokenView => () =>
41 | {
42 | NavigateTo(new XamlPageWithIssue());
43 | };
44 |
45 | private Action ShowAboutPopup => async () =>
46 | {
47 | await ShowPopup(new AboutPopupPage());
48 | };
49 |
50 | private Action ShowFeedback => async () =>
51 | {
52 | var lastEventId = SentrySdk.LastEventId;
53 | if (!lastEventId.Equals(SentryId.Empty))
54 | {
55 | await ShowPopup(new UserFeedbackPopupPage(), new UserFeedbackPopupPageViewModel(), new Dictionary { { "SentryId", lastEventId } });
56 | }
57 | else
58 | {
59 | _ = DisplayAlert("Well", "Nothing broke so there's no need to give feedbacks...", "OK");
60 | }
61 | };
62 |
63 | private Action DoLogin => () =>
64 | {
65 | try
66 | {
67 | var authService = new AuthService();
68 | authService.DoLogin("admin", "1234");
69 | }
70 | catch(Exception ex)
71 | {
72 | SentrySdk.CaptureException(ex);
73 | DisplayAlert("Whoops", "A handled exception happened", "OK");
74 | }
75 | };
76 |
77 | private Action Unhandle => () =>
78 | {
79 | var authService = new AuthService();
80 | authService.DoLogin("admin", "1234");
81 | };
82 |
83 | private Action NativeCrash => () =>
84 | {
85 | _nativeCrashService?.BrokenNativeCallback();
86 | DisplayAlert("Whoops", "A native crash sample wasn't implemented for this platform, mind opening a pull request? :)", "Yes");
87 | };
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/ViewModels/Popups/AboutPagePopupPageViewModel.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Protocol;
2 | using Sample.Xamarin.Core.Interfaces;
3 | using Sample.Xamarin.Core.Views.Popups;
4 | using System;
5 | using Xamarin.Essentials;
6 | using Xamarin.Forms;
7 | using Browser = Xamarin.Essentials.Browser;
8 | using Sentry;
9 |
10 | namespace Sample.Xamarin.Core.ViewModels.Popups
11 | {
12 | public class AboutPagePopupPageViewModel : NavigationService
13 | {
14 | public Command PluginGithubCmd { get; }
15 | public Command BuyCmd { get; }
16 |
17 | public AboutPagePopupPageViewModel()
18 | {
19 | PluginGithubCmd = new Command(PluginGithub);
20 | BuyCmd = new Command(Buy);
21 | }
22 |
23 | private Action PluginGithub => async () =>
24 | {
25 | SentrySdk.AddBreadcrumb("plugin github", "ui.click", level: BreadcrumbLevel.Info);
26 | try
27 | {
28 | await Browser.OpenAsync(new Uri("https://github.com/rotorgames/Rg.Plugins.Popup"), BrowserLaunchMode.SystemPreferred);
29 | }
30 | catch (Exception ex)
31 | {
32 | SentrySdk.CaptureException(ex);
33 | }
34 | };
35 |
36 | private Action Buy => () =>
37 | {
38 | SentrySdk.AddBreadcrumb("buy", "ui.click", level: BreadcrumbLevel.Info);
39 | ShowPopup(new PaymentPopupPage());
40 | };
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/DiscoPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
10 |
14 |
15 |
18 |
20 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/LoginPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
24 |
25 |
26 |
27 |
29 |
34 |
35 |
37 |
38 |
39 |
42 |
43 |
45 |
46 |
47 |
48 |
51 |
55 |
59 |
63 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/LoginPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Views
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class LoginPage : ContentPage
8 | {
9 | public LoginPage()
10 | {
11 | InitializeComponent();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Rg.Plugins.Popup.Services;
2 | using Sample.Xamarin.Core.Views;
3 | using Sample.Xamarin.Core.Views.Popups;
4 | using System;
5 | using Xamarin.Forms;
6 |
7 | namespace Sample.Xamarin.Core.Views
8 | {
9 | public partial class MainPage : ContentPage
10 | {
11 | public MainPage()
12 | {
13 | InitializeComponent();
14 | }
15 |
16 | private void Disco_Clicked(object sender, EventArgs e)
17 | {
18 | Navigation.PushAsync(new DiscoPage());
19 | }
20 |
21 | private void Popup_Clicked(object sender, EventArgs e)
22 | {
23 | PopupNavigation.Instance.PushAsync(new AboutPopupPage());
24 | }
25 | private void Xaml_Clicked(object sender, EventArgs e)
26 | {
27 | Navigation.PushAsync(new XamlPageWithIssue());
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/Popups/AboutPopupPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Rg.Plugins.Popup.Services;
2 | using System;
3 | using Xamarin.Forms.Xaml;
4 |
5 | namespace Sample.Xamarin.Core.Views.Popups
6 | {
7 | [XamlCompilation(XamlCompilationOptions.Compile)]
8 | public partial class AboutPopupPage : Rg.Plugins.Popup.Pages.PopupPage
9 | {
10 | public AboutPopupPage()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 | private void Popup_Clicked(object sender, EventArgs e)
16 | {
17 | PopupNavigation.Instance.PushAsync(new PaymentPopupPage());
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/Popups/PaymentPopupPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
21 |
31 |
32 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/Popups/PaymentPopupPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Views.Popups
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class PaymentPopupPage : Rg.Plugins.Popup.Pages.PopupPage
8 | {
9 | public PaymentPopupPage()
10 | {
11 | InitializeComponent();
12 | Task.Run(async () =>
13 | {
14 | await Task.Delay(5000);
15 | if (IsVisible)
16 | {
17 | IsVisible = false;
18 | }
19 | });
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/Views/Popups/UserFeedbackPopupPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Xamarin.Forms.Xaml;
3 |
4 | namespace Sample.Xamarin.Core.Views.Popups
5 | {
6 | [XamlCompilation(XamlCompilationOptions.Compile)]
7 | public partial class UserFeedbackPopupPage : Rg.Plugins.Popup.Pages.PopupPage
8 | {
9 | public UserFeedbackPopupPage()
10 | {
11 | InitializeComponent();
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/XamlPageWithIssue.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Core/XamlPageWithIssue.xaml.cs:
--------------------------------------------------------------------------------
1 | using Sentry;
2 | using System;
3 | using Xamarin.Forms;
4 |
5 | namespace Sample.Xamarin.Core
6 | {
7 | public partial class XamlPageWithIssue : ContentPage
8 | {
9 | public XamlPageWithIssue()
10 | {
11 | try
12 | {
13 | InitializeComponent();
14 | }
15 | catch (Exception ex)
16 | {
17 | SentrySdk.CaptureException(ex);
18 | }
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with your package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Dependencies/NativeCrash.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content;
3 | using Android.OS;
4 | using Android.Runtime;
5 | using Android.Views;
6 | using Android.Widget;
7 | using Com.Sentry.Ovenlibrary;
8 | using Sample.Xamarin.Core.Interfaces;
9 | using Sample.Xamarin.Droid.Dependencies;
10 | using System;
11 | using System.Collections.Generic;
12 | using Xamarin.Forms;
13 |
14 | [assembly: Dependency(typeof(NativeCrash))]
15 | namespace Sample.Xamarin.Droid.Dependencies
16 | {
17 | public class NativeCrash : INativeCrash
18 | {
19 | public void BrokenNativeCallback()
20 | {
21 | var oven = new Oven();
22 | // Cook is a Java opcode that executes an external C function that will crash the app.
23 | oven.Cook();
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.OS;
3 | using Android.Runtime;
4 | using Xamarin.Forms;
5 | using Xamarin.Essentials;
6 | using Sample.Xamarin.Core;
7 | using Color = Android.Graphics.Color;
8 | using Android.Content.PM;
9 | using Sentry;
10 | using AndroidX.Activity;
11 |
12 | namespace Sample.Xamarin.Droid
13 | {
14 | [Activity(Label = "Sentry.Xamarin.Forms.Sample", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.UiMode)]
15 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
16 | {
17 | protected override void OnCreate(Bundle savedInstanceState)
18 | {
19 | SentryXamarin.Init(options =>
20 | {
21 | options.Dsn = "https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112";
22 | options.AddXamarinFormsIntegration();
23 | options.Debug = true;
24 | options.AttachScreenshots = true;
25 | });
26 |
27 | TabLayoutResource = Resource.Layout.Tabbar;
28 | ToolbarResource = Resource.Layout.Toolbar;
29 |
30 | base.OnCreate(savedInstanceState);
31 |
32 | Rg.Plugins.Popup.Popup.Init(this);
33 |
34 | Platform.Init(this, savedInstanceState);
35 | SetStatusBarColor(Color.Rgb(46, 14, 51));
36 | Forms.SetFlags("Shapes_Experimental");
37 | Forms.Init(this, savedInstanceState);
38 | LoadApplication(new App());
39 | }
40 |
41 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
42 | {
43 | Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
44 |
45 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
46 | }
47 |
48 | [System.Obsolete]
49 | public override void OnBackPressed()
50 | {
51 | if (!Rg.Plugins.Popup.Popup.SendBackPressed(base.OnBackPressed))
52 | {
53 | base.OnBackPressed();
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using Android.App;
4 |
5 | [assembly: AssemblyTitle("Sample.Xamarin.Droid")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("Sample.Xamarin.Droid")]
10 | [assembly: AssemblyCopyright("Copyright © 2020")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 | [assembly: ComVisible(false)]
14 |
15 | [assembly: AssemblyVersion("1.0.0.0")]
16 | [assembly: AssemblyFileVersion("1.0.0.0")]
17 |
18 | // Add some common permissions, these can be removed if not needed
19 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
20 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
21 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
51 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable-hdpi/splashscreen_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable-hdpi/splashscreen_img.jpg
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable-mdpi/splashscreen_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable-mdpi/splashscreen_img.jpg
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable-xhdpi/splashscreen_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable-xhdpi/splashscreen_img.jpg
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable-xxhdpi/splashscreen_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable-xxhdpi/splashscreen_img.jpg
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable-xxxhdpi/splashscreen_img.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable-xxxhdpi/splashscreen_img.jpg
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable/disco_light.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable/disco_light.gif
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable/login_background_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable/login_background_logo.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/drawable/login_background_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/drawable/login_background_top.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/layout/Tabbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/layout/Toolbar.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-anydpi-v26/icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-anydpi-v26/icon_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-hdpi/icon.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-hdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-hdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-mdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-mdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xhdpi/icon.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxhdpi/icon.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Droid/Resources/mipmap-xxxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
14 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Droid/SplashActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.OS;
3 |
4 | namespace Sample.Xamarin.Droid
5 | {
6 | [Activity(Theme = "@style/Theme.Splash", ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait, MainLauncher = true, NoHistory = true)]
7 | public class SplashActivity : Activity
8 | {
9 | protected override void OnCreate(Bundle savedInstanceState)
10 | {
11 | base.OnCreate(savedInstanceState);
12 | StartActivity(typeof(MainActivity));
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using AppKit;
2 | using CoreGraphics;
3 | using Foundation;
4 | using Sentry;
5 |
6 | namespace Sample.Xamarin.Mac
7 | {
8 | [Register("AppDelegate")]
9 | public class AppDelegate : NSApplicationDelegate
10 | {
11 | private SampleWindowController _windowController;
12 |
13 | public override void DidFinishLaunching(NSNotification notification)
14 | {
15 | SentryXamarin.Init(options =>
16 | {
17 | options.Dsn = "https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112";
18 | options.Debug = true;
19 | });
20 |
21 | _windowController = new SampleWindowController();
22 |
23 | var screenRect = NSScreen.MainScreen.VisibleFrame;
24 | var offsetFromLeft = 10;
25 | var offsetFromTop = 10;
26 | var offsetFromBottom = screenRect.GetMaxY() - _windowController.Window.Frame.Height - offsetFromTop;
27 |
28 | _windowController.Window.SetFrameOrigin(new CGPoint(offsetFromLeft, offsetFromBottom));
29 | _windowController.Window.MakeKeyAndOrderFront(this);
30 | }
31 |
32 | public override void WillTerminate(NSNotification notification)
33 | {
34 | // Insert code here to tear down your application
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "filename": "AppIcon-16.png",
5 | "size": "16x16",
6 | "scale": "1x",
7 | "idiom": "mac"
8 | },
9 | {
10 | "filename": "AppIcon-16@2x.png",
11 | "size": "16x16",
12 | "scale": "2x",
13 | "idiom": "mac"
14 | },
15 | {
16 | "filename": "AppIcon-32.png",
17 | "size": "32x32",
18 | "scale": "1x",
19 | "idiom": "mac"
20 | },
21 | {
22 | "filename": "AppIcon-32@2x.png",
23 | "size": "32x32",
24 | "scale": "2x",
25 | "idiom": "mac"
26 | },
27 | {
28 | "filename": "AppIcon-128.png",
29 | "size": "128x128",
30 | "scale": "1x",
31 | "idiom": "mac"
32 | },
33 | {
34 | "filename": "AppIcon-128@2x.png",
35 | "size": "128x128",
36 | "scale": "2x",
37 | "idiom": "mac"
38 | },
39 | {
40 | "filename": "AppIcon-256.png",
41 | "size": "256x256",
42 | "scale": "1x",
43 | "idiom": "mac"
44 | },
45 | {
46 | "filename": "AppIcon-256@2x.png",
47 | "size": "256x256",
48 | "scale": "2x",
49 | "idiom": "mac"
50 | },
51 | {
52 | "filename": "AppIcon-512.png",
53 | "size": "512x512",
54 | "scale": "1x",
55 | "idiom": "mac"
56 | },
57 | {
58 | "filename": "AppIcon-512@2x.png",
59 | "size": "512x512",
60 | "scale": "2x",
61 | "idiom": "mac"
62 | }
63 | ],
64 | "info": {
65 | "version": 1,
66 | "author": "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleName
6 | Sample.Xamarin.Mac
7 | CFBundleIdentifier
8 | com.companyname.Sample.Xamarin.Mac
9 | CFBundleShortVersionString
10 | 1.0
11 | CFBundleVersion
12 | 1
13 | CFBundleDevelopmentRegion
14 | en
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundlePackageType
18 | APPL
19 | CFBundleSignature
20 | ????
21 | NSHumanReadableCopyright
22 | ${AuthorCopyright:HtmlEncode}
23 | NSPrincipalClass
24 | NSApplication
25 | NSMainStoryboardFile
26 | Main
27 | XSAppIconAssets
28 | Assets.xcassets/AppIcon.appiconset
29 | LSMinimumSystemVersion
30 | 10.14
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/Main.cs:
--------------------------------------------------------------------------------
1 | using AppKit;
2 |
3 | namespace Sample.Xamarin.Mac
4 | {
5 | static class MainClass
6 | {
7 | static void Main (string [] args)
8 | {
9 | NSApplication.Init ();
10 | NSApplication.Main (args);
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/SampleView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using AppKit;
4 | using CoreGraphics;
5 | using Sentry;
6 |
7 | namespace Sample.Xamarin.Mac
8 | {
9 | public class SampleView : NSView
10 | {
11 | private readonly List _views = new List();
12 |
13 | public SampleView()
14 | {
15 | InitializeButtons();
16 | }
17 |
18 | public override bool IsFlipped => true;
19 |
20 | public override void Layout()
21 | {
22 | var bounds = Bounds;
23 |
24 | if (bounds.IsEmpty) return;
25 |
26 | var y = 40;
27 | foreach (var view in _views)
28 | {
29 | view.Frame = new CGRect(10, y, 300, 28);
30 | y += 38;
31 | }
32 | }
33 |
34 | private void InitializeButtons()
35 | {
36 | AddButton("Throw managed exception (uncaught)", ThrowManagedExceptionUncaught);
37 | AddButton("Throw managed exception (caught)", ThrowManagedExceptionCaught);
38 | Layout();
39 | }
40 |
41 | private void ThrowManagedExceptionUncaught()
42 | {
43 | throw new Exception("Managed exception");
44 | }
45 |
46 | private void ThrowManagedExceptionCaught()
47 | {
48 | try
49 | {
50 | throw new Exception("Managed exception (caught)");
51 | }
52 | catch (Exception e)
53 | {
54 | SentrySdk.CaptureException(e);
55 | }
56 | }
57 |
58 | private void AddButton(string title, Action action)
59 | {
60 | var button = new NSButton();
61 | button.BezelStyle = NSBezelStyle.Rounded;
62 | button.SetButtonType(NSButtonType.MomentaryPushIn);
63 | button.Title = title;
64 | button.Activated += (_, _) =>
65 | {
66 | action.Invoke();
67 | };
68 |
69 | _views.Add(button);
70 | AddSubview(button);
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/SampleViewController.cs:
--------------------------------------------------------------------------------
1 | using AppKit;
2 |
3 | namespace Sample.Xamarin.Mac
4 | {
5 | public class SampleViewController : NSViewController
6 | {
7 | private SampleView _view;
8 |
9 | public override void LoadView()
10 | {
11 | _view = new SampleView();
12 | base.View = _view;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/SampleWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using AppKit;
3 | using CoreGraphics;
4 |
5 | namespace Sample.Xamarin.Mac
6 | {
7 | public class SampleWindow : NSWindow
8 | {
9 | private SampleViewController _sampleViewController;
10 |
11 | public SampleWindow(IntPtr handle) : base(handle)
12 | {
13 | Initialize();
14 | }
15 |
16 | public SampleWindow()
17 | {
18 | Initialize();
19 | }
20 |
21 | void Initialize()
22 | {
23 | SetFrame(new CGRect(0, 0, 1024, 768), true, true);
24 | StyleMask = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled | NSWindowStyle.FullSizeContentView;
25 | Title = "Sentry Xamarin.Mac Sample";
26 |
27 | _sampleViewController = new SampleViewController();
28 |
29 | ContentView.AutoresizesSubviews = true;
30 | ContentView.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable;
31 | _sampleViewController.View.Frame = ContentView.Bounds;
32 | ContentView.AddSubview(_sampleViewController.View);
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.Mac/SampleWindowController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using AppKit;
3 |
4 | namespace Sample.Xamarin.Mac
5 | {
6 | public class SampleWindowController : NSWindowController
7 | {
8 | private readonly SampleWindow _window;
9 |
10 | public SampleWindowController(IntPtr handle) : base(handle)
11 | {
12 | base.Window = _window = new SampleWindow();
13 | }
14 |
15 | public SampleWindowController()
16 | {
17 | base.Window = _window = new SampleWindow();
18 | }
19 |
20 | public new SampleWindow Window => _window;
21 | }
22 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Sentry;
2 | using Sentry.Infrastructure;
3 | using System;
4 | using Windows.ApplicationModel;
5 | using Windows.ApplicationModel.Activation;
6 | using Windows.UI.Xaml;
7 | using Windows.UI.Xaml.Controls;
8 | using Windows.UI.Xaml.Navigation;
9 |
10 | namespace Sample.Xamarin.uwp
11 | {
12 | sealed partial class App : Application
13 | {
14 | protected override void OnLaunched(LaunchActivatedEventArgs e)
15 | {
16 | SentryXamarin.Init(options =>
17 | {
18 | options.Dsn = "https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112";
19 | options.AddXamarinFormsIntegration();
20 | options.Debug = true;
21 | options.DiagnosticLogger = new TraceDiagnosticLogger(SentryLevel.Debug);
22 | options.AttachScreenshots = true;
23 | options.SendDefaultPii = true;
24 | });
25 | Frame rootFrame = Window.Current.Content as Frame;
26 |
27 | if (rootFrame == null)
28 | {
29 | rootFrame = new Frame();
30 |
31 | rootFrame.NavigationFailed += OnNavigationFailed;
32 | Rg.Plugins.Popup.Popup.Init();
33 | global::Xamarin.Forms.Forms.SetFlags("Shapes_Experimental");
34 | global::Xamarin.Forms.Forms.Init(e, Rg.Plugins.Popup.Popup.GetExtraAssemblies());
35 |
36 | Window.Current.Content = rootFrame;
37 | }
38 |
39 | if (e.PrelaunchActivated == false)
40 | {
41 | if (rootFrame.Content == null)
42 | {
43 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
44 | }
45 | Window.Current.Activate();
46 | }
47 | }
48 |
49 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
50 | {
51 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
52 | }
53 |
54 | private void OnSuspending(object sender, SuspendingEventArgs e)
55 | {
56 | var deferral = e.SuspendingOperation.GetDeferral();
57 | deferral.Complete();
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Assets/sentry-glyph-light-48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/Assets/sentry-glyph-light-48x48.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Sample.Xamarin.uwp
2 | {
3 | public sealed partial class MainPage
4 | {
5 | public MainPage()
6 | {
7 | this.InitializeComponent();
8 | LoadApplication(new Core.App());
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
14 |
15 |
16 |
17 |
18 | Sample.Xamarin.uwp
19 | sentry
20 | Assets\StoreLogo.png
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
35 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Sample.Xamarin.uwp")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Sample.Xamarin.uwp")]
14 | [assembly: AssemblyCopyright("Copyright © 2020")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: CLSCompliant(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Build and Revision Numbers
27 | // by using the '*' as shown below:
28 | // [assembly: AssemblyVersion("1.0.*")]
29 | [assembly: AssemblyVersion("1.0.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/Sample.Xamarin.UWP.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework =
3 | build_property.TargetPlatformMinVersion = 10.0.17763.0
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids = {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
6 | build_property.PublishSingleFile =
7 | build_property.IncludeAllContentForSelfExtract =
8 | build_property._SupportedPlatformList =
9 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/disco_light.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/disco_light.gif
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/login_background_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/login_background_logo.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.UWP/login_background_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.UWP/login_background_top.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sample.Xamarin.Core;
3 | using Sentry;
4 | using UIKit;
5 |
6 | namespace Sample.Xamarin.iOS
7 | {
8 | [Register("AppDelegate")]
9 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
10 | {
11 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
12 | {
13 | SentryXamarin.Init(options =>
14 | {
15 | options.Dsn = "https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112";
16 | options.AddXamarinFormsIntegration();
17 | options.Debug = true;
18 | options.AttachScreenshots = true;
19 | });
20 | Rg.Plugins.Popup.Popup.Init();
21 | global::Xamarin.Forms.Forms.SetFlags("Shapes_Experimental");
22 | global::Xamarin.Forms.Forms.Init();
23 | LoadApplication(new App());
24 |
25 | return base.FinishedLaunching(app, options);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "scale": "2x",
5 | "size": "20x20",
6 | "idiom": "iphone",
7 | "filename": "Icon40.png"
8 | },
9 | {
10 | "scale": "3x",
11 | "size": "20x20",
12 | "idiom": "iphone",
13 | "filename": "Icon60.png"
14 | },
15 | {
16 | "scale": "2x",
17 | "size": "29x29",
18 | "idiom": "iphone",
19 | "filename": "Icon58.png"
20 | },
21 | {
22 | "scale": "3x",
23 | "size": "29x29",
24 | "idiom": "iphone",
25 | "filename": "Icon87.png"
26 | },
27 | {
28 | "scale": "2x",
29 | "size": "40x40",
30 | "idiom": "iphone",
31 | "filename": "Icon80.png"
32 | },
33 | {
34 | "scale": "3x",
35 | "size": "40x40",
36 | "idiom": "iphone",
37 | "filename": "Icon120.png"
38 | },
39 | {
40 | "scale": "2x",
41 | "size": "60x60",
42 | "idiom": "iphone",
43 | "filename": "Icon120.png"
44 | },
45 | {
46 | "scale": "3x",
47 | "size": "60x60",
48 | "idiom": "iphone",
49 | "filename": "Icon180.png"
50 | },
51 | {
52 | "scale": "1x",
53 | "size": "20x20",
54 | "idiom": "ipad",
55 | "filename": "Icon20.png"
56 | },
57 | {
58 | "scale": "2x",
59 | "size": "20x20",
60 | "idiom": "ipad",
61 | "filename": "Icon40.png"
62 | },
63 | {
64 | "scale": "1x",
65 | "size": "29x29",
66 | "idiom": "ipad",
67 | "filename": "Icon29.png"
68 | },
69 | {
70 | "scale": "2x",
71 | "size": "29x29",
72 | "idiom": "ipad",
73 | "filename": "Icon58.png"
74 | },
75 | {
76 | "scale": "1x",
77 | "size": "40x40",
78 | "idiom": "ipad",
79 | "filename": "Icon40.png"
80 | },
81 | {
82 | "scale": "2x",
83 | "size": "40x40",
84 | "idiom": "ipad",
85 | "filename": "Icon80.png"
86 | },
87 | {
88 | "scale": "1x",
89 | "size": "76x76",
90 | "idiom": "ipad",
91 | "filename": "Icon76.png"
92 | },
93 | {
94 | "scale": "2x",
95 | "size": "76x76",
96 | "idiom": "ipad",
97 | "filename": "Icon152.png"
98 | },
99 | {
100 | "scale": "2x",
101 | "size": "83.5x83.5",
102 | "idiom": "ipad",
103 | "filename": "Icon167.png"
104 | },
105 | {
106 | "scale": "1x",
107 | "size": "1024x1024",
108 | "idiom": "ios-marketing",
109 | "filename": "Icon1024.png"
110 | }
111 | ],
112 | "properties": {},
113 | "info": {
114 | "version": 1,
115 | "author": "xcode"
116 | }
117 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Dependencies/NativeCrash.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sample.Xamarin.Core.Interfaces;
3 | using Sample.Xamarin.iOS.Dependencies;
4 | using Xamarin.Forms;
5 |
6 | [assembly: Dependency(typeof(NativeCrash))]
7 | namespace Sample.Xamarin.iOS.Dependencies
8 | {
9 | public class NativeCrash : INativeCrash
10 | {
11 | public void BrokenNativeCallback()
12 | {
13 | var dict = new NSMutableDictionary();
14 | dict.LowlevelSetObject(System.IntPtr.Zero, System.IntPtr.Zero);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UISupportedInterfaceOrientations
11 |
12 | UIInterfaceOrientationPortrait
13 | UIInterfaceOrientationLandscapeLeft
14 | UIInterfaceOrientationLandscapeRight
15 |
16 | UISupportedInterfaceOrientations~ipad
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationPortraitUpsideDown
20 | UIInterfaceOrientationLandscapeLeft
21 | UIInterfaceOrientationLandscapeRight
22 |
23 | MinimumOSVersion
24 | 10.0
25 | CFBundleDisplayName
26 | Sentry.Xamarin.Sample
27 | CFBundleIdentifier
28 | com.companyname.Sentry.Xamarin.Sample
29 | CFBundleVersion
30 | 1.0
31 | UILaunchStoryboardName
32 | LaunchScreen
33 | CFBundleName
34 | Sentry.Xamarin.Sample
35 | XSAppIconAssets
36 | Assets.xcassets/AppIcon.appiconset
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Main.cs:
--------------------------------------------------------------------------------
1 | using UIKit;
2 |
3 | namespace Sample.Xamarin.iOS
4 | {
5 | public static class Application
6 | {
7 | static void Main(string[] args)
8 | {
9 | UIApplication.Main(args, null, typeof(AppDelegate));
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Some Key Group
6 |
7 |
8 | test
9 | test
10 |
11 |
12 | test
13 | test
14 |
15 |
16 |
17 | NSPrivacyAccessedAPITypes
18 |
19 |
20 | NSPrivacyAccessedAPIType
21 | NSPrivacyAccessedAPICategoryFileTimestamp
22 | NSPrivacyAccessedAPITypeReasons
23 |
24 | C617.1
25 |
26 |
27 |
28 | NSPrivacyAccessedAPIType
29 | NSPrivacyAccessedAPICategorySystemBootTime
30 | NSPrivacyAccessedAPITypeReasons
31 |
32 | 35F9.1
33 |
34 |
35 |
36 |
37 | Another Key Group
38 |
39 |
40 | test
41 | test
42 |
43 |
44 | test
45 | test
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Sentry.Xamarin.Sample.iOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Sentry.Xamarin.Sample.iOS")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/Default-Portrait.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/Default.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/Default@2x.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/disco_light.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/disco_light.gif
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/login_background_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/login_background_logo.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Resources/login_background_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Samples/Sample.Xamarin.iOS/Resources/login_background_top.png
--------------------------------------------------------------------------------
/Samples/Sample.Xamarin.iOS/Sample.Xamarin.iOS.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework =
3 | build_property.TargetPlatformMinVersion =
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids = {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
6 | build_property.PublishSingleFile =
7 | build_property.IncludeAllContentForSelfExtract =
8 | build_property._SupportedPlatformList =
9 |
--------------------------------------------------------------------------------
/Sentry.Xamarin-CI-Build-Windows.slnf:
--------------------------------------------------------------------------------
1 | {
2 | "solution": {
3 | "path": "Sentry.Xamarin.sln",
4 | "projects": [
5 | "Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj",
6 | "Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj",
7 | "Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj",
8 | "Samples\\Sample.Xamarin.UWP\\Sample.Xamarin.UWP.csproj",
9 | "Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj",
10 | "Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj",
11 | "Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj",
12 | "Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj",
13 | "Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj",
14 | "Tests\\Sentry.Xamarin.Forms.UWP.Tests\\Sentry.Xamarin.Forms.UWP.Tests.csproj"
15 | ]
16 | }
17 | }
--------------------------------------------------------------------------------
/Sentry.Xamarin-CI-Build-macOS.slnf:
--------------------------------------------------------------------------------
1 | {
2 | "solution": {
3 | "path": "Sentry.Xamarin.sln",
4 | "projects": [
5 | "Src\\Sentry.Xamarin\\Sentry.Xamarin.csproj",
6 | "Src\\Sentry.Xamarin.Forms\\Sentry.Xamarin.Forms.csproj",
7 | "Samples\\Sample.Xamarin.Core\\Sample.Xamarin.Core.csproj",
8 | "Samples\\Sample.Xamarin.Mac\\Sample.Xamarin.Mac.csproj",
9 | "Samples\\Forms\\com.sentry.ovenlibrary\\com.sentry.ovenlibrary.csproj",
10 | "Samples\\Sample.Xamarin.Droid\\Sample.Xamarin.Droid.csproj",
11 | "Tests\\Sentry.Xamarin.Forms.Testing\\Sentry.Xamarin.Forms.Testing.csproj",
12 | "Tests\\Sentry.Xamarin.Tests\\Sentry.Xamarin.Tests.csproj"
13 | ]
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Extensibility/DisabledNavigationPage.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Internals;
2 |
3 | namespace Sentry.Xamarin.Forms.Extensibility
4 | {
5 | internal class DisabledNavigationPage : IPageNavigationTracker
6 | {
7 | public static DisabledNavigationPage Instance = new();
8 |
9 | public string CurrentPage => null;
10 |
11 | public void Register(IHub hub, SentryOptions options) { }
12 |
13 | public void Unregister() { }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Extensions/PageExtensions.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Internals;
2 | using Xamarin.Forms;
3 |
4 | namespace Sentry.Xamarin.Forms.Extensions
5 | {
6 | internal static class PageExtensions
7 | {
8 | internal static PageInfo GetPageType(this Page page)
9 | {
10 | var type = page.GetType();
11 | if (type?.Name is null)
12 | {
13 | return new PageInfo()
14 | {
15 | Name = page.Title
16 | };
17 | }
18 | return new PageInfo()
19 | {
20 | Name = type.Name,
21 | BaseType = type.BaseType?.Name
22 | };
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Extensions/SentryXamarinFormsIntegrationExtensions.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Forms.Internals;
2 |
3 | namespace Sentry.Xamarin.Forms.Extensions
4 | {
5 | internal static class SentryXamarinFormsIntegrationExtensions
6 | {
7 | internal static void UnregisterNativeIntegration(this SentryXamarinFormsIntegration integration, SentryXamarinOptions options)
8 | {
9 | #if NATIVE_PROCESSOR
10 | integration?.Nativeintegration?.Unregister();
11 | #endif
12 | options.NativeIntegrationEnabled = false;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Extensions/SentryXamarinOptionsExtensions.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Forms.Extensibility;
2 | using Sentry.Xamarin.Forms.Internals;
3 |
4 | namespace Sentry
5 | {
6 | ///
7 | /// Extend SentryXamarinOptions by allowing it to manipulate options from Sentry Xamarin Forms.
8 | ///
9 | public static partial class SentryXamarinOptionsExtensions
10 | {
11 | internal static readonly string ProtocolPackageName = "sentry.dotnet.xamarin-forms";
12 |
13 | ///
14 | /// Add the Sentry Xamarin Forms integration to Sentry.Xamarin SDK.
15 | ///
16 | /// The Sentry Xamarion Options.
17 | public static void AddXamarinFormsIntegration(this SentryXamarinOptions options)
18 | {
19 | var applicationListener = new FormsApplicationListener(options);
20 |
21 | var formsIntegration = new SentryXamarinFormsIntegration(options);
22 | options.AddIntegration(formsIntegration);
23 | applicationListener.AddListener(formsIntegration.RegisterRequestThemeChange);
24 |
25 | if (options.PageTracker is null)
26 | {
27 | var navigationIntegration = new FormsNavigationIntegration();
28 | options.AddPageNavigationTrackerIntegration(navigationIntegration);
29 | applicationListener.AddListener(navigationIntegration.ApplySentryNavigationEvents);
30 | }
31 |
32 | options.ProtocolPackageName = ProtocolPackageName;
33 |
34 | applicationListener.Invoke();
35 | }
36 |
37 | ///
38 | /// Disables the default integration that registers the page and popup navigation.
39 | ///
40 | /// The Sentry Xamarion Options.
41 | public static void RemoveNavigationPageIntegration(this SentryXamarinOptions options)
42 | {
43 | var oldTracker = options.PageTracker;
44 | oldTracker?.Unregister();
45 | options.PageTracker = DisabledNavigationPage.Instance;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Internals/FormsApplicationListener.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using Xamarin.Forms;
5 |
6 | namespace Sentry.Xamarin.Forms.Internals
7 | {
8 | internal class FormsApplicationListener
9 | {
10 | private readonly List> _listeners = new List>();
11 |
12 | private readonly SentryXamarinOptions _options;
13 |
14 | ///
15 | /// Class that returns the current application to any listener once available.
16 | ///
17 | /// The sentry Xamarin options.
18 | public FormsApplicationListener(SentryXamarinOptions options) => _options = options;
19 |
20 | ///
21 | /// Adds a callback to a function that requires the Application.
22 | ///
23 | /// A function that requires the application in order to work properly.
24 | public void AddListener(Action listener) => _listeners.Add(listener);
25 |
26 | ///
27 | /// Inokes a task that will wait for the initialization of Application.Current.
28 | /// On Success, it'll return the current application to all registered listeners.
29 | ///
30 | public void Invoke() =>
31 | //Don't lock the main Thread while waiting for the current application to be created.
32 | Task.Run(async () =>
33 | {
34 | var application = await GetCurrentApplication().ConfigureAwait(false);
35 | if (application is null)
36 | {
37 | _options.DiagnosticLogger?.Log(SentryLevel.Warning, "Sentry.Xamarin.Forms timeout for tracking Application.Current. Navigation tracking is going to be disabled");
38 | return;
39 | }
40 |
41 | foreach(var hook in _listeners)
42 | {
43 | hook.Invoke(application);
44 | }
45 | });
46 |
47 | ///
48 | /// Get the current Application.
49 | /// If SentrySDK was initialized from the Native project (Android/IOS) the Application might not have been created in time.
50 | /// So we wait for max 7 seconds to see check if it was created or not
51 | ///
52 | /// Current application.
53 | private async Task GetCurrentApplication()
54 | {
55 | for (int i = 0; i < _options.GetCurrentApplicationMaxRetries && Application.Current is null; i++)
56 | {
57 | await Task.Delay(_options.GetCurrentApplicationDelay).ConfigureAwait(false);
58 | }
59 | return Application.Current;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Internals/PageInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Internals
2 | {
3 | ///
4 | /// A minimal subset of information to describe the selected page.
5 | ///
6 | internal class PageInfo
7 | {
8 | ///
9 | /// The name of the page.
10 | ///
11 | internal string Name { get; set; }
12 | ///
13 | /// The name of the base type, if found.
14 | ///
15 | internal string BaseType { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Internals/SentryXamarinFormsIntegration.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Extensions;
2 | using Sentry.Integrations;
3 | using System.Collections.Generic;
4 | using Xamarin.Forms;
5 | using Xamarin.Forms.Internals;
6 |
7 | namespace Sentry.Xamarin.Forms.Internals
8 | {
9 | internal class SentryXamarinFormsIntegration : ISdkIntegration
10 | {
11 | internal static SentryXamarinFormsIntegration Instance { get; set; }
12 |
13 | private readonly SentryXamarinOptions _options;
14 |
15 | private DelegateLogListener _xamarinLogger;
16 | private IHub _hub;
17 |
18 | public SentryXamarinFormsIntegration(SentryXamarinOptions options) => _options = options;
19 |
20 | ///
21 | /// Register the Sentry Xamarin Forms SDK on Sentry.NET SDK
22 | ///
23 | /// the Hub.
24 | /// the Sentry options.
25 | public void Register(IHub hub, SentryOptions options)
26 | {
27 | //Only one integration can be active
28 | if (Instance != null)
29 | {
30 | return;
31 | }
32 | Instance = this;
33 | _hub = hub;
34 |
35 | RegisterXamarinFormsLogListener(hub);
36 | }
37 |
38 | ///
39 | /// creates breadcrumbs from events received from RequestedThemeChanged on the given application.
40 | ///
41 | /// The Xamarin Application.
42 | internal void RegisterRequestThemeChange(Application application)
43 | => application.RequestedThemeChanged += Current_RequestedThemeChanged;
44 |
45 | internal void RegisterXamarinFormsLogListener(IHub hub)
46 | {
47 | _xamarinLogger = new DelegateLogListener((logger, issue) =>
48 | {
49 | if (_options.XamarinLoggerEnabled)
50 | {
51 | hub?.AddInternalBreadcrumb(_options,
52 | null,
53 | "xamarin",
54 | "info",
55 | new Dictionary
56 | {
57 | ["logger"] = logger,
58 | ["issue"] = issue
59 | }, level: BreadcrumbLevel.Warning);
60 | }
61 | });
62 |
63 | if (_options.XamarinLoggerEnabled)
64 | {
65 | Log.Listeners.Add(_xamarinLogger);
66 | }
67 | }
68 |
69 | private void Current_RequestedThemeChanged(object sender, AppThemeChangedEventArgs themeEvent)
70 | => _hub?.AddBreadcrumb(themeEvent.RequestedTheme.ToString(), "AppTheme.Change", level: BreadcrumbLevel.Info);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 | [assembly: InternalsVisibleTo("Sentry.Xamarin.Forms.UWP.Tests")]
4 | [assembly: InternalsVisibleTo("Sentry.Xamarin.Forms.Testing")]
5 |
6 | [assembly: CLSCompliant(true)]
7 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin.Forms/Sentry.Xamarin.Forms.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 |
7 | netstandard2.0;
8 | $(NoWarn);RS0017
9 | true
10 |
11 | Sentry.Xamarin.Forms
12 | Sentry.Xamarin.Forms
13 | Sentry.Xamarin.Forms
14 | Sentry
15 | Official Sentry SDK for Xamarin Forms - Open-source error tracking that helps developers monitor and fix crashes in real time.
16 |
17 | <_WriteTelemetryProperties>false
18 | $(AdditionalConstants)
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Extensions/IHubExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Sentry.Extensions
6 | {
7 | internal static class IHubExtensions
8 | {
9 | internal const string DuplicatedBreadcrumbDropped = "Duplicated breadrumb dropped.";
10 |
11 | ///
12 | /// Adds an automatic breadcrumb to the current scope if the previous one wasn't the same.
13 | ///
14 | /// The Hub which holds the scope stack
15 | /// The SentryXamarinOptions that holds the last breadcrumb info.
16 | /// The message.
17 | /// Category.
18 | /// Breadcrumb type.
19 | /// Additional data.
20 | /// Breadcrumb level.
21 | internal static void AddInternalBreadcrumb(
22 | this IHub hub,
23 | SentryXamarinOptions options,
24 | string message,
25 | string? category = null,
26 | string? type = null,
27 | Dictionary? data = null,
28 | BreadcrumbLevel level = BreadcrumbLevel.Info)
29 | {
30 | var previousBreadcrumb = options.LastInternalBreadcrumb;
31 | //Filter duplicated internal breadcrumbs
32 | if (previousBreadcrumb != null &&
33 | previousBreadcrumb.Message == message &&
34 | previousBreadcrumb.Category == category &&
35 | previousBreadcrumb.Type == type &&
36 | previousBreadcrumb.Data?.Except(data).Any() is false &&
37 | DateTimeOffset.UtcNow.Subtract(previousBreadcrumb.Timestamp).TotalSeconds < options.InternalBreadcrumbDuplicationTimeSpan)
38 | {
39 | //Skip
40 | options.DiagnosticLogger?.Log(SentryLevel.Debug, DuplicatedBreadcrumbDropped);
41 | }
42 | else
43 | {
44 | var breadcrumb = new Breadcrumb(message, type, data, category, level);
45 | hub.ConfigureScope(s => s.AddBreadcrumb(breadcrumb));
46 | options.LastInternalBreadcrumb = breadcrumb;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Extensions/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Xamarin.Extensions
2 | {
3 | internal static class StringExtensions
4 | {
5 | internal static string FilterUnknownOrEmpty(this string @string)
6 | => string.IsNullOrEmpty(@string) || @string == "unknown" ? null : @string;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/Device/Screenshot/ScreenshotAttachment.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Internals.Device.Screenshot
2 | {
3 | internal class ScreenshotAttachment : SentryAttachment
4 | {
5 | public ScreenshotAttachment(IAttachmentContent content)
6 | : this(
7 | AttachmentType.Default,
8 | content,
9 | "screenshot.jpg",
10 | "image/jpeg")
11 | {
12 | }
13 |
14 | private ScreenshotAttachment(
15 | AttachmentType type,
16 | IAttachmentContent content,
17 | string fileName,
18 | string? contentType)
19 | : base(type, content, fileName, contentType)
20 | {
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/Device/Screenshot/ScreenshotAttachmentContent.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using Xamarin.Essentials;
3 | using static Xamarin.Essentials.Screenshot;
4 |
5 | namespace Sentry.Internals.Device.Screenshot
6 | {
7 | internal class ScreenshotAttachmentContent : IAttachmentContent
8 | {
9 | public Stream GetStream()
10 | {
11 | var screenStream = CaptureAsync().ConfigureAwait(false).GetAwaiter().GetResult();
12 | return screenStream.OpenReadAsync(ScreenshotFormat.Jpeg).ConfigureAwait(false).GetAwaiter().GetResult();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/DeviceModel.mac.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Foundation;
4 | using ObjCConstants = ObjCRuntime.Constants;
5 |
6 | namespace Sentry.Xamarin.Internals
7 | {
8 | [Preserve(AllMembers = true)]
9 | internal partial class DeviceModel
10 | {
11 | private const string HardwareMachine = "hw.machine";
12 | private const string HardwareModel = "hw.model";
13 |
14 | [DllImport(ObjCConstants.SystemLibrary)]
15 | static extern int sysctlbyname([MarshalAs(UnmanagedType.LPStr)] string property, IntPtr output, IntPtr oldLen, IntPtr newp, uint newlen);
16 |
17 | public string Machine => GetWithSysCtlByName(HardwareMachine, "Unknown");
18 |
19 | public string Model => GetWithSysCtlByName(HardwareModel, "Unknown");
20 |
21 | private string GetWithSysCtlByName(string key, string defaultValue)
22 | {
23 | try
24 | {
25 | var pLen = Marshal.AllocHGlobal(sizeof(int));
26 | sysctlbyname(key, IntPtr.Zero, pLen, IntPtr.Zero, 0);
27 |
28 | var length = Marshal.ReadInt32(pLen);
29 |
30 | if (length == 0)
31 | {
32 | Marshal.FreeHGlobal(pLen);
33 | return defaultValue;
34 | }
35 |
36 | var pStr = Marshal.AllocHGlobal(length);
37 | sysctlbyname(key, pStr, pLen, IntPtr.Zero, 0);
38 |
39 | var hardwareStr = Marshal.PtrToStringAnsi(pStr);
40 |
41 | Marshal.FreeHGlobal(pLen);
42 | Marshal.FreeHGlobal(pStr);
43 |
44 | return hardwareStr ?? defaultValue;
45 | }
46 | catch
47 | {
48 | return defaultValue;
49 | }
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/IPageNavigationTracker.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Integrations;
2 |
3 | namespace Sentry.Xamarin.Internals
4 | {
5 | ///
6 | /// Interface that should be implemented to track the page navigation on an app.
7 | ///
8 | interface IPageNavigationTracker : ISdkIntegration
9 | {
10 | ///
11 | /// The name of the current page on the application.
12 | ///
13 | public string CurrentPage { get; }
14 |
15 | ///
16 | /// Disable the navigation code.
17 | ///
18 | public void Unregister();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeEventProcessor.ios.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sentry.Extensibility;
3 | using System;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Text.RegularExpressions;
7 |
8 | namespace Sentry.Xamarin.Internals
9 | {
10 | internal class NativeEventProcessor : ISentryEventProcessor
11 | {
12 | private Lazy _IosContext = new Lazy(() => new IosContext());
13 | private SentryXamarinOptions _options;
14 | private volatile bool _IosContextLoaded = true;
15 |
16 | public NativeEventProcessor(SentryXamarinOptions options) => _options = options;
17 | private class IosContext
18 | {
19 | internal long? MemorySize { get; }
20 | internal string Device { get; }
21 | internal long GetStorageSize()
22 | => (long)NSFileManager.DefaultManager.GetFileSystemAttributes(Environment.GetFolderPath(Environment.SpecialFolder.Personal)).FreeSize;
23 |
24 | internal IosContext()
25 | {
26 | MemorySize = (long)NSProcessInfo.ProcessInfo.PhysicalMemory;
27 | var model = new DeviceModel();
28 | Device = model.GetModel();
29 | }
30 | }
31 |
32 | public SentryEvent Process(SentryEvent @event)
33 | {
34 | if (_IosContextLoaded)
35 | {
36 | try
37 | {
38 | var IosContext = _IosContext.Value;
39 | @event.Contexts.Device.MemorySize = _IosContext.Value.MemorySize;
40 | @event.Contexts.Device.StorageSize = _IosContext.Value.GetStorageSize();
41 | }
42 | catch (Exception ex)
43 | {
44 | _options.DiagnosticLogger?.Log(SentryLevel.Error, "Failed to add iOSEventProcessor into event.", ex);
45 | //In case of any failure, this process function will be disabled to avoid throwing exceptions for future events.
46 | _IosContextLoaded = false;
47 | }
48 | }
49 | else
50 | {
51 | _options.DiagnosticLogger?.Log(SentryLevel.Debug, "iOSEventProcessor disabled due to previous error.");
52 | }
53 | return @event;
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeEventProcessor.mac.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sentry.Extensibility;
3 | using System;
4 | using System.Linq;
5 | using System.Reflection;
6 | using System.Text.RegularExpressions;
7 |
8 | namespace Sentry.Xamarin.Internals
9 | {
10 | internal class NativeEventProcessor : ISentryEventProcessor
11 | {
12 | private Lazy _MacContext = new Lazy(() => new MacContext());
13 | private SentryXamarinOptions _options;
14 | private volatile bool _MacContextLoaded = true;
15 |
16 | public NativeEventProcessor(SentryXamarinOptions options) => _options = options;
17 | private class MacContext
18 | {
19 | internal long? MemorySize { get; }
20 | internal string Device { get; }
21 | internal long GetStorageSize()
22 | => (long)NSFileManager.DefaultManager.GetFileSystemAttributes(Environment.GetFolderPath(Environment.SpecialFolder.Personal)).FreeSize;
23 |
24 | internal MacContext()
25 | {
26 | MemorySize = (long)NSProcessInfo.ProcessInfo.PhysicalMemory;
27 | var model = new DeviceModel();
28 | Device = model.Machine;
29 | }
30 | }
31 |
32 | public SentryEvent Process(SentryEvent @event)
33 | {
34 | if (_MacContextLoaded)
35 | {
36 | try
37 | {
38 | var MacContext = _MacContext.Value;
39 | @event.Contexts.Device.MemorySize = _MacContext.Value.MemorySize;
40 | @event.Contexts.Device.StorageSize = _MacContext.Value.GetStorageSize();
41 | }
42 | catch (Exception ex)
43 | {
44 | _options.DiagnosticLogger?.Log(SentryLevel.Error, "Failed to add MacEventProcessor into event.", ex);
45 | //In case of any failure, this process function will be disabled to avoid throwing exceptions for future events.
46 | _MacContextLoaded = false;
47 | }
48 | }
49 | else
50 | {
51 | _options.DiagnosticLogger?.Log(SentryLevel.Debug, "MacEventProcessor disabled due to previous error.");
52 | }
53 | return @event;
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeEventProcessor.uwp.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Extensibility;
2 | using System;
3 | using Windows.Security.ExchangeActiveSyncProvisioning;
4 | using Windows.System.Profile;
5 | using UwpPackage = Windows.ApplicationModel.Package;
6 |
7 | namespace Sentry.Xamarin.Internals
8 | {
9 | internal class NativeEventProcessor : ISentryEventProcessor
10 | {
11 | private Lazy _uwpContext = new Lazy(() => new UwpContext());
12 | private volatile bool _uwpContextLoaded = true;
13 |
14 | private SentryOptions _options;
15 |
16 | public NativeEventProcessor(SentryOptions options) => _options = options;
17 |
18 | private class UwpContext
19 | {
20 | internal string DeviceFamily { get; }
21 | internal string DeviceFriendlyName { get; }
22 | internal string OsName { get; }
23 | internal string OsVersion { get; }
24 | internal string OsArchitecture { get; }
25 |
26 | internal UwpContext()
27 | {
28 | DeviceFamily = AnalyticsInfo.VersionInfo.DeviceFamily;
29 |
30 | var version = ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion);
31 | var major = (version & 0xFFFF000000000000L) >> 48;
32 | var minor = (version & 0x0000FFFF00000000L) >> 32;
33 | var build = (version & 0x00000000FFFF0000L) >> 16;
34 | var revision = (version & 0x000000000000FFFFL);
35 | OsVersion = $"{major}.{minor}.{build}.{revision}";
36 |
37 | OsArchitecture = UwpPackage.Current.Id.Architecture.ToString();
38 | var deviceInfo = new EasClientDeviceInformation();
39 | OsName = char.ToUpper(deviceInfo.OperatingSystem[0]) +
40 | deviceInfo.OperatingSystem.Remove(0,1).ToLower();
41 | DeviceFriendlyName = deviceInfo.FriendlyName;
42 | }
43 | }
44 |
45 | public SentryEvent Process(SentryEvent @event)
46 | {
47 | if (_uwpContextLoaded)
48 | {
49 | try
50 | {
51 | var uwpContext = _uwpContext.Value;
52 | @event.Contexts.Device.Family = uwpContext.DeviceFamily;
53 | @event.Contexts.Device.Name = uwpContext.DeviceFriendlyName;
54 | @event.Contexts.OperatingSystem.Name = uwpContext.OsName;
55 | @event.Contexts.OperatingSystem.Version = uwpContext.OsVersion;
56 | }
57 | catch (Exception ex)
58 | {
59 | _options.DiagnosticLogger?.Log(SentryLevel.Error, "Failed to add UwpPlatformEventProcessor into event.", ex);
60 | //In case of any failure, this process function will be disabled to avoid throwing exceptions for future events.
61 | _uwpContextLoaded = false;
62 | }
63 | }
64 | else
65 | {
66 | _options.DiagnosticLogger?.Log(SentryLevel.Debug, "UwpPlatformEventProcessor disabled due to previous error.");
67 | }
68 | return @event;
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeExceptionProcessor.ios.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sentry.Extensibility;
3 | using System;
4 | using System.Linq;
5 |
6 | namespace Sentry.Xamarin.Internals
7 | {
8 | internal class NativeExceptionProcessor : ISentryEventExceptionProcessor
9 | {
10 | private NativeStackTraceFactory _nativeStack;
11 |
12 | public NativeExceptionProcessor(SentryXamarinOptions options)
13 | {
14 | _nativeStack = new NativeStackTraceFactory(options);
15 | }
16 |
17 | public void Process(Exception exception, SentryEvent sentryEvent)
18 | {
19 | if (exception is MonoTouchException monoException)
20 | {
21 | var managedException = sentryEvent.SentryExceptions.First();
22 | managedException.Value = monoException.Reason;
23 | managedException.Type = monoException.Name;
24 | managedException.Stacktrace = _nativeStack.CreateNativeStackTrace(managedException.Stacktrace, monoException.NSException.CallStackSymbols);
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeExceptionProcessor.mac.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 | using Sentry.Extensibility;
3 | using System;
4 | using System.Linq;
5 |
6 | namespace Sentry.Xamarin.Internals
7 | {
8 | internal class NativeExceptionProcessor : ISentryEventExceptionProcessor
9 | {
10 | private NativeStackTraceFactory _nativeStack;
11 |
12 | public NativeExceptionProcessor(SentryXamarinOptions options)
13 | {
14 | _nativeStack = new NativeStackTraceFactory(options);
15 | }
16 |
17 | public void Process(Exception exception, SentryEvent sentryEvent)
18 | {
19 | if (exception is ObjCException objCException)
20 | {
21 | var managedException = sentryEvent.SentryExceptions.First();
22 | managedException.Value = objCException.Reason;
23 | managedException.Type = objCException.Name;
24 | managedException.Stacktrace = _nativeStack.CreateNativeStackTrace(managedException.Stacktrace, objCException.NSException.CallStackSymbols);
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeIntegration.droid.cs:
--------------------------------------------------------------------------------
1 | using Android.Runtime;
2 | using Sentry.Extensions;
3 | using Sentry.Integrations;
4 | using Sentry.Protocol;
5 | using System;
6 | using System.Collections.Generic;
7 | using Xamarin.Essentials;
8 |
9 | namespace Sentry.Xamarin.Internals
10 | {
11 | internal class NativeIntegration : ISdkIntegration
12 | {
13 |
14 | private SentryXamarinOptions _xamarinOptions;
15 | private IHub _hub;
16 |
17 | internal NativeIntegration(SentryXamarinOptions options) => _xamarinOptions = options;
18 |
19 | ///
20 | /// Initialize the Android specific code.
21 | ///
22 | /// The hub.
23 | /// The Sentry options.
24 | public void Register(IHub hub, SentryOptions options)
25 | {
26 | try
27 | {
28 | _hub = hub;
29 | Platform.ActivityStateChanged += Platform_ActivityStateChanged;
30 | AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser;
31 | }
32 | catch (Exception ex)
33 | {
34 | options.DiagnosticLogger?.Log(SentryLevel.Error, "Sentry.Xamarin failed to attach AtivityStateChanged", ex);
35 | _xamarinOptions.NativeIntegrationEnabled = false;
36 | }
37 | }
38 |
39 | internal void Unregister()
40 | {
41 | if (_xamarinOptions.NativeIntegrationEnabled)
42 | {
43 | Platform.ActivityStateChanged -= Platform_ActivityStateChanged;
44 | }
45 | }
46 |
47 | private void Platform_ActivityStateChanged(object sender, ActivityStateChangedEventArgs e)
48 | {
49 | _hub.AddInternalBreadcrumb(_xamarinOptions,
50 | null,
51 | "ui.lifecycle",
52 | "navigation", data: new Dictionary
53 | {
54 | ["screen"] = _xamarinOptions.PageTracker?.CurrentPage,
55 | ["state"] = e.State.ToString()
56 | }, level: BreadcrumbLevel.Info);
57 | if (e.State == ActivityState.Paused)
58 | {
59 | _xamarinOptions.SessionLogger?.StatePaused();
60 | }
61 | else if (e.State == ActivityState.Resumed)
62 | {
63 | _xamarinOptions.SessionLogger?.StateResumed();
64 | }
65 | }
66 | private void AndroidEnvironment_UnhandledExceptionRaiser(object sender, RaiseThrowableEventArgs e)
67 | {
68 | e.Exception.Data[Mechanism.HandledKey] = e.Handled;
69 | e.Exception.Data[Mechanism.MechanismKey] = "UnhandledExceptionRaiser";
70 | SentrySdk.CaptureException(e.Exception);
71 | if (!e.Handled)
72 | {
73 | SentrySdk.Close();
74 | }
75 |
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeIntegration.mac.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Integrations;
2 | using System.Reflection;
3 |
4 | namespace Sentry.Xamarin.Internals
5 | {
6 | internal class NativeIntegration : ISdkIntegration
7 | {
8 | private SentryXamarinOptions _xamarinOptions;
9 | private IHub _hub;
10 |
11 | internal NativeIntegration(SentryXamarinOptions options)
12 | {
13 | _xamarinOptions = options;
14 | _xamarinOptions.ProjectName = Assembly.GetEntryAssembly().GetName().Name;
15 | }
16 | ///
17 | /// Initialize the iOS specific code.
18 | ///
19 | /// The hub.
20 | /// The Sentry options.
21 | public void Register(IHub hub, SentryOptions options)
22 | {
23 | _hub = hub;
24 | options.AddExceptionProcessor(new NativeExceptionProcessor(_xamarinOptions));
25 | RegisterInAppExclude();
26 | }
27 |
28 | private void RegisterInAppExclude()
29 | {
30 | _xamarinOptions.AddInAppExclude("AppKit.");
31 | _xamarinOptions.AddInAppExclude("Foundation.NS");
32 | _xamarinOptions.AddInAppExclude("ObjCRuntime");
33 | }
34 | internal void Unregister()
35 | {
36 | _xamarinOptions.NativeIntegrationEnabled = false;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeIntegration.uwp.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Extensions;
2 | using Sentry.Integrations;
3 | using Sentry.Protocol;
4 | using System;
5 | using System.Runtime.ExceptionServices;
6 | using System.Security;
7 | using Windows.ApplicationModel;
8 | using Windows.UI.Xaml;
9 | using UwpUnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs;
10 |
11 | namespace Sentry.Xamarin.Internals
12 | {
13 | internal class NativeIntegration : ISdkIntegration
14 | {
15 | private IHub _hub;
16 | private Application _application;
17 | private SentryXamarinOptions _options { get; }
18 |
19 | internal NativeIntegration(SentryXamarinOptions options) => _options = options;
20 |
21 | ///
22 | /// Initialize the UWP specific code.
23 | ///
24 | /// The hub.
25 | /// The Sentry options.
26 | public void Register(IHub hub, SentryOptions options)
27 | {
28 | _hub = hub;
29 |
30 | _application = Application.Current;
31 | if (_application != null)
32 | {
33 | _application.UnhandledException += NativeHandle;
34 | _application.EnteredBackground += OnSleep;
35 | _application.LeavingBackground += OnResume;
36 | }
37 | }
38 | internal void Unregister()
39 | {
40 | if (_application != null)
41 | {
42 | _application.UnhandledException -= NativeHandle;
43 | _application.EnteredBackground -= OnSleep;
44 | _application.LeavingBackground -= OnResume;
45 | }
46 | }
47 |
48 | [HandleProcessCorruptedStateExceptions, SecurityCritical]
49 | internal void NativeHandle(object sender, UwpUnhandledExceptionEventArgs e)
50 | {
51 | //We need to backup the reference, because the Exception reference last for one access.
52 | //After that, a new Exception reference is going to be set into e.Exception.
53 | var exception = e.Exception;
54 |
55 | Unregister();
56 | Handle(exception);
57 | }
58 |
59 | [HandleProcessCorruptedStateExceptions, SecurityCritical]
60 | internal void Handle(Exception exception)
61 | {
62 | if (exception != null)
63 | {
64 | exception.Data[Mechanism.HandledKey] = false;
65 | exception.Data[Mechanism.MechanismKey] = "Application.UnhandledException";
66 | _hub.CaptureException(exception);
67 | _hub.FlushAsync(TimeSpan.FromSeconds(10)).Wait();
68 | (_hub as IDisposable)?.Dispose();
69 | }
70 | }
71 |
72 | private void OnSleep(object sender, EnteredBackgroundEventArgs e)
73 | {
74 | _hub.AddInternalBreadcrumb(_options, "OnSleep", "app.lifecycle", "event");
75 | _options.SessionLogger?.StatePaused();
76 | }
77 |
78 | private void OnResume(object sender, LeavingBackgroundEventArgs e)
79 | {
80 | _hub.AddInternalBreadcrumb(_options, "OnResume", "app.lifecycle", "event");
81 | _options.SessionLogger?.StateResumed();
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/NativeStackTraceFactory.ios.mac.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Extensibility;
2 | using Sentry.Protocol;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Linq;
7 | using System.Runtime.InteropServices;
8 | using System.Text.RegularExpressions;
9 |
10 | namespace Sentry.Xamarin.Internals
11 | {
12 | internal class NativeStackTraceFactory
13 | {
14 | private static string _nativeRegexFormat => "(?\\d+)\\s+(?[a-zA-Z\\.-_?]+)\\s+(?0x[0-9a-fA-F]+)\\s+(?.+?(?=\\s\\+))\\s+\\+\\s+(?\\d+)";
15 | //"(?\d+)\s+(?[a-zA-Z\.-?]+)\s+(?0x[0-9a-fA-F]+)\s+(?.+?(?=\s\+))\s+\+\s+(?\d+)"
16 | private readonly SentryXamarinOptions _options;
17 |
18 | public NativeStackTraceFactory(SentryXamarinOptions options) => _options = options;
19 |
20 | internal bool IsNativeException(string exceptionValue)
21 | => exceptionValue.StartsWith("Objective-C exception");
22 |
23 | internal SentryStackTrace CreateNativeStackTrace(SentryStackTrace managedStackTrace, IList nativeStackTrace)
24 | {
25 | for (int i = nativeStackTrace.Count - 1; i >= 0; i--)
26 | {
27 | var match = Regex.Match(nativeStackTrace[i], _nativeRegexFormat);
28 | if (match.Success)
29 | {
30 | var method = match.Groups["method"].Value;
31 | managedStackTrace.Frames.Add(new SentryStackFrame
32 | {
33 | Platform = "native",
34 | Function = match.Groups["function"].Value,
35 | Package = method,
36 | InstructionAddress = Convert.ToInt64(match.Groups["offset"].Value, 16), //Hex offset.
37 | InApp = method == _options.ProjectName,
38 | });
39 | }
40 | }
41 | return managedStackTrace;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/SentryAndroidHelpers.droid.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using Sentry.Android.AssemblyReader;
5 | using Sentry.Extensibility;
6 |
7 | using Appliction = Android.App.Application;
8 | using AndroidBuild = Android.OS.Build;
9 |
10 | namespace Sentry.Xamarin.Internals
11 | {
12 | internal static class SentryAndroidHelpers
13 | {
14 | public static IList GetSupportedAbis()
15 | {
16 | var result = AndroidBuild.SupportedAbis;
17 | if (result != null)
18 | {
19 | return result;
20 | }
21 |
22 | #pragma warning disable CS0618
23 | var abi = AndroidBuild.CpuAbi;
24 | #pragma warning restore CS0618
25 |
26 | return abi != null ? new[] {abi} : Array.Empty();
27 | }
28 |
29 | public static IAndroidAssemblyReader? GetAndroidAssemblyReader(IDiagnosticLogger? logger)
30 | {
31 | var apkPath = Appliction.Context.ApplicationInfo?.SourceDir;
32 | if (apkPath == null)
33 | {
34 | logger?.LogWarning("Can't determine APK path.");
35 | return null;
36 | }
37 |
38 | if (!File.Exists(apkPath))
39 | {
40 | logger?.LogWarning("APK doesn't exist at {0}", apkPath);
41 | return null;
42 | }
43 |
44 | try
45 | {
46 | var supportedAbis = GetSupportedAbis();
47 | return AndroidAssemblyReaderFactory.Open(apkPath, supportedAbis,
48 | logger: (message, args) => logger?.Log(SentryLevel.Debug, message, args: args));
49 | }
50 | catch (Exception ex)
51 | {
52 | logger?.LogError(ex, "Cannot create assembly reader.");
53 | return null;
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/Session/DeviceActiveLogger.droid.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Internals.Session
2 | {
3 | internal class DeviceActiveLogger : IDeviceActiveLogger
4 | {
5 | private bool FirstResumed { get; set; }
6 |
7 | ///
8 | /// IsPaused is used to track if the app is currently in background
9 | ///
10 | private bool IsPaused;
11 |
12 | ///
13 | /// Informs if the device is on background.
14 | ///
15 | /// True if the app is on background, otherwise false
16 | public bool IsBackground() => IsPaused;
17 |
18 | ///
19 | public void StatePaused()
20 | {
21 | if (!IsPaused)
22 | {
23 | IsPaused = true;
24 | SentrySdk.PauseSession();
25 | }
26 | }
27 |
28 | ///
29 | public void StateResumed()
30 | {
31 | // When the app is launched, the Resumed state is triggered.
32 | // We don't want to register a Resume session when the app initiates.
33 | if (!FirstResumed)
34 | {
35 | FirstResumed = true;
36 | }
37 | // Allow the resume setup only if the previous state was paused.
38 | // Otherwise, we'll ignore the resume session since it's already resumed.
39 | else
40 | {
41 | IsPaused = false;
42 | SentrySdk.ResumeSession();
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/Session/DeviceActiveLogger.ios.uwp.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Internals.Session
2 | {
3 | internal class DeviceActiveLogger : IDeviceActiveLogger
4 | {
5 | private bool _isPaused { get; set; }
6 |
7 | ///
8 | /// Informs if the device is on background.
9 | ///
10 | /// True if the app is on background, otherwise false
11 | public bool IsBackground() => _isPaused;
12 |
13 | ///
14 | public void StatePaused()
15 | {
16 | _isPaused = true;
17 | SentrySdk.PauseSession();
18 | }
19 |
20 | ///
21 | public void StateResumed()
22 | {
23 | _isPaused = false;
24 | SentrySdk.ResumeSession();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Internals/Session/IDeviceActiveLogger.cs:
--------------------------------------------------------------------------------
1 | namespace Sentry.Internals.Session
2 | {
3 | internal interface IDeviceActiveLogger
4 | {
5 | void StatePaused();
6 |
7 | void StateResumed();
8 |
9 | bool IsBackground();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Privacy/SentryPrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyCollectedDataTypes
6 |
7 |
8 | NSPrivacyCollectedDataType
9 | NSPrivacyCollectedDataTypeCrashData
10 | NSPrivacyCollectedDataTypeLinked
11 |
12 | NSPrivacyCollectedDataTypeTracking
13 |
14 | NSPrivacyCollectedDataTypePurposes
15 |
16 | NSPrivacyCollectedDataTypePurposeAppFunctionality
17 |
18 |
19 |
20 | NSPrivacyCollectedDataType
21 | NSPrivacyCollectedDataTypePerformanceData
22 | NSPrivacyCollectedDataTypeLinked
23 |
24 | NSPrivacyCollectedDataTypeTracking
25 |
26 | NSPrivacyCollectedDataTypePurposes
27 |
28 | NSPrivacyCollectedDataTypePurposeAppFunctionality
29 |
30 |
31 |
32 | NSPrivacyCollectedDataType
33 | NSPrivacyCollectedDataTypeOtherDiagnosticData
34 | NSPrivacyCollectedDataTypeLinked
35 |
36 | NSPrivacyCollectedDataTypeTracking
37 |
38 | NSPrivacyCollectedDataTypePurposes
39 |
40 | NSPrivacyCollectedDataTypePurposeAppFunctionality
41 |
42 |
43 |
44 | NSPrivacyAccessedAPITypes
45 |
46 |
47 | NSPrivacyAccessedAPIType
48 | NSPrivacyAccessedAPICategoryFileTimestamp
49 | NSPrivacyAccessedAPITypeReasons
50 |
51 | C617.1
52 |
53 |
54 |
55 | NSPrivacyAccessedAPIType
56 | NSPrivacyAccessedAPICategorySystemBootTime
57 | NSPrivacyAccessedAPITypeReasons
58 |
59 | 35F9.1
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 | [assembly: InternalsVisibleTo("Sentry.Xamarin.Forms")]
4 | [assembly: InternalsVisibleTo("Sentry.Xamarin.Tests")]
5 | [assembly: InternalsVisibleTo("Sentry.Xamarin.Forms.UWP.Tests")]
6 |
7 | [assembly: CLSCompliant(true)]
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/SentryXamarin.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Xamarin.Essentials;
3 |
4 | namespace Sentry
5 | {
6 | ///
7 | /// Sentry Xamarin SDK entrypoint.
8 | ///
9 | ///
10 | /// This is a facade to the SDK instance that also Initializes Sentry .NET SDK.
11 | /// use SentrySdk for additional operations (like capturing exceptions, messages,...).
12 | ///
13 | public static class SentryXamarin
14 | {
15 |
16 | internal static readonly string ProtocolPackageName = "sentry.dotnet.xamarin";
17 |
18 | ///
19 | /// Initializes the SDK with an optional configuration options callback.
20 | ///
21 | /// The configure options.
22 | public static void Init(Action configureOptions)
23 | {
24 | var options = new SentryXamarinOptions();
25 | // Set the release now but give the user a chance to reset it (i.e: to null to rely on the built-in format)
26 | options.Release = $"{AppInfo.PackageName}@{AppInfo.VersionString}+{AppInfo.BuildString}";
27 |
28 | configureOptions?.Invoke(options);
29 |
30 | options.ConfigureSentryXamarinOptions();
31 | options.RegisterNativeActivityStatus();
32 | options.RegisterNativeIntegrations();
33 | options.RegisterXamarinEventProcessors();
34 | options.RegisterXamarinInAppExclude();
35 | options.ProtocolPackageName ??= ProtocolPackageName;
36 |
37 | Init(options);
38 | }
39 |
40 | ///
41 | /// Initializes the SDK with the specified options instance.
42 | ///
43 | /// The options instance
44 | public static void Init(SentryXamarinOptions options)
45 | {
46 | if (SentrySdk.IsEnabled)
47 | {
48 | options.DiagnosticLogger?.Log(
49 | SentryLevel.Warning,
50 | "SentryXamarin.Init was called again. It should only be called once. Any change to options will be ignored.");
51 |
52 | return;
53 | }
54 |
55 | SentrySdk.Init(options);
56 |
57 | options.RegisterScreenshotEventProcessor();
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/Src/Sentry.Xamarin/SentryXamarinOptions.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Internals.Session;
2 | using Sentry.Xamarin.Internals;
3 |
4 | #if __ANDROID__
5 | using System;
6 | using Sentry.Android.AssemblyReader;
7 | #endif
8 |
9 | namespace Sentry
10 | {
11 | ///
12 | /// Sentry Xamarin SDK options.
13 | ///
14 | public class SentryXamarinOptions : SentryOptions
15 | {
16 | ///
17 | /// Automatically attaches a screenshot of the app at the time of the event capture.
18 | ///
19 | ///
20 | /// Be aware PII might be included by activating this feature.
21 | ///
22 | public bool AttachScreenshots { get; set; }
23 |
24 | ///
25 | /// Define the range of time that duplicated internal breadcrumbs will be ignored.
26 | ///
27 | public int InternalBreadcrumbDuplicationTimeSpan { get; set; } = 2;
28 |
29 | internal bool XamarinLoggerEnabled { get; set; } = true;
30 | internal bool NativeIntegrationEnabled { get; set; } = true;
31 | internal bool InternalCacheEnabled { get; set; } = true;
32 | internal IPageNavigationTracker PageTracker { get; set; }
33 | internal string ProtocolPackageName { get; set; }
34 | internal string ProjectName { get; set; }
35 | internal int GetCurrentApplicationDelay { get; set; } = 500;
36 | internal int GetCurrentApplicationMaxRetries { get; set; } = 15;
37 |
38 | ///
39 | /// Redirects session callbacks to SentrySdk based on
40 | /// device's app status.
41 | ///
42 | internal IDeviceActiveLogger SessionLogger { get; set; }
43 |
44 | internal Breadcrumb LastInternalBreadcrumb {get;set;}
45 |
46 | ///
47 | /// The Sentry Xamarin Options.
48 | ///
49 | public SentryXamarinOptions()
50 | {
51 | IsEnvironmentUser = false;
52 | AutoSessionTracking = true;
53 | IsGlobalModeEnabled = true;
54 |
55 | #if __ANDROID__
56 | var reader = new Lazy(() =>
57 | SentryAndroidHelpers.GetAndroidAssemblyReader(DiagnosticLogger));
58 | AssemblyReader = name => reader.Value?.TryReadAssembly(name);
59 | #endif
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.Testing/ExpectedOSNames.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Sentry.Xamarin.Forms.Testing
5 | {
6 | public static class ExpectedOSNames
7 | {
8 | public static List Names = new List { "Android", "iOS", "tvOS", "Tizen", "Windows", "watchOS", "Unknown"};
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.Testing/Mock/MockDiagnosticLogger.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Extensibility;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Sentry.Xamarin.Forms.Testing.Mock
7 | {
8 | public class MockDiagnosticLogger : IDiagnosticLogger
9 | {
10 | private SentryLevel _level;
11 | private List<(SentryLevel, string, Exception, object[])> _logs = new List<(SentryLevel, string, Exception, object[])>();
12 | public MockDiagnosticLogger(SentryLevel level) => _level = level;
13 |
14 | public bool IsEnabled(SentryLevel level) => _level >= level;
15 |
16 | public void Log(SentryLevel logLevel, string message, Exception exception = null, params object[] args)
17 | {
18 | _logs.Add((logLevel, message, exception, args));
19 | }
20 |
21 | public int Count() => _logs.Count;
22 |
23 | public (SentryLevel, string, Exception, object[]) LastItem() => _logs.LastOrDefault();
24 |
25 | public bool Contains(string message) => _logs.Any(l => l.Item2.Contains(message));
26 | public bool Contains(SentryLevel level, string message) => _logs.Any(l => l.Item1 == level && l.Item2.Contains(message));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.Testing/Sentry.Xamarin.Forms.Testing.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/getsentry/sentry-xamarin/4a198aaa0a519ca766eb13304940402d9716c453/Tests/Sentry.Xamarin.Forms.UWP.Tests/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Extensions/SentryXamarinOptionsExtensionsTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace Sentry.Xamarin.Forms.UWP.Tests.Extensions
4 | {
5 | public class SentryXamarinOptionsExtensionsTests
6 | {
7 | [Fact]
8 | public void ConfigureSentryOptions_ReleaseNotSetIfInformed()
9 | {
10 | //Arrange
11 | var options = new SentryXamarinOptions()
12 | {
13 | Release = "myrelease@1.1"
14 | };
15 |
16 | //Act
17 | options.ConfigureSentryXamarinOptions();
18 |
19 | //Assert
20 | Assert.Equal(options.Release, options.Release);
21 | }
22 | [Fact]
23 | public void ConfigureSentryOptions_DefaultCachePathDisabled_CachePathNotSet()
24 | {
25 | //Arrange
26 | var options = new SentryXamarinOptions()
27 | {
28 | CacheDirectoryPath = null,
29 | InternalCacheEnabled = false
30 | };
31 |
32 | //Act
33 | options.ConfigureSentryXamarinOptions();
34 |
35 | //Assert
36 | Assert.Null(options.CacheDirectoryPath);
37 | }
38 |
39 | [Fact]
40 | public void ConfigureSentryOptions_DefaultCachePathEnabledAndCacheDirectoryPathNull_CachePathSet()
41 | {
42 | //Arrange
43 | var options = new SentryXamarinOptions()
44 | {
45 | CacheDirectoryPath = null
46 | };
47 | var expectedPath = options.DefaultCacheDirectoryPath();
48 |
49 | //Act
50 | options.ConfigureSentryXamarinOptions();
51 |
52 | //Assert
53 | Assert.Equal(expectedPath, options.CacheDirectoryPath);
54 | Assert.NotNull(expectedPath);
55 | }
56 |
57 | [Fact]
58 | public void ConfigureSentryOptions_DefaultCachePathEnabledAndCacheDirectorySet_CachePathSkipped()
59 | {
60 | //Arrange
61 | var expectedPath = "./";
62 | var options = new SentryXamarinOptions()
63 | {
64 | CacheDirectoryPath = expectedPath,
65 | };
66 |
67 | //Act
68 | options.ConfigureSentryXamarinOptions();
69 |
70 | //Assert
71 | Assert.Equal(expectedPath, options.CacheDirectoryPath);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Internals/FormsApplicationListenerTests.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Forms.Internals;
2 | using Sentry.Xamarin.Forms.Testing.Mock;
3 | using System;
4 | using System.Threading.Tasks;
5 | using Xamarin.Forms;
6 | using Xunit;
7 |
8 | namespace Sentry.Xamarin.Forms.UWP.Tests.Internals
9 | {
10 | public class FormsApplicationListenerTests
11 | {
12 | [Fact]
13 | // Test
14 | public async Task Register_FormsNotInitialized_HooksNotInvoked()
15 | {
16 | //Assert
17 | var mockDiagnostic = new MockDiagnosticLogger(SentryLevel.Debug);
18 | var options = new SentryXamarinOptions()
19 | {
20 | Debug = true,
21 | DiagnosticLogger = mockDiagnostic,
22 | GetCurrentApplicationDelay = 1,
23 | GetCurrentApplicationMaxRetries = 1
24 | };
25 | var integration = new FormsApplicationListener(options);
26 | var mockHub = new MockHub();
27 | Action badListener = (_) => throw null;
28 | integration.AddListener(badListener);
29 |
30 | //Act
31 | integration.Invoke();
32 |
33 | await Task.Delay(options.GetCurrentApplicationDelay + 100);
34 |
35 | //Assert
36 | Assert.True(mockDiagnostic.Contains("Sentry.Xamarin.Forms timeout for tracking Application.Current. Navigation tracking is going to be disabled"));
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Internals/NativeEventProcessorTests.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Internals;
2 | using Xunit;
3 |
4 | namespace Sentry.Xamarin.Forms.UWP.Tests.Internals
5 | {
6 | public class NativeEventProcessorTests
7 | {
8 | [Fact]
9 | public void Register_ValidEvent_ContainFormatedWindowsNAme()
10 | {
11 | //Arrange
12 | var eventProcessor = new NativeEventProcessor(new SentryOptions());
13 | var @event = new SentryEvent();
14 |
15 | //Act
16 | @event = eventProcessor.Process(@event);
17 |
18 | //Act
19 | Assert.Equal("Windows", @event.Contexts.OperatingSystem.Name);
20 | }
21 |
22 | [Fact]
23 | public void Register_ValidEvent_ContainDeviceNameAndFamily()
24 | {
25 | //Arrange
26 | var eventProcessor = new NativeEventProcessor(new SentryOptions());
27 | var @event = new SentryEvent();
28 |
29 | //Act
30 | @event = eventProcessor.Process(@event);
31 |
32 | //Act
33 | Assert.NotNull(@event.Contexts.Device.Family);
34 | Assert.NotNull(@event.Contexts.Device.Name);
35 | }
36 |
37 | [Fact]
38 | public void Register_ValidEvent_ContainOperationalSystemNameAndVersion()
39 | {
40 | //Arrange
41 | var eventProcessor = new NativeEventProcessor(new SentryOptions());
42 | var @event = new SentryEvent();
43 |
44 | //Act
45 | @event = eventProcessor.Process(@event);
46 |
47 | //Act
48 | Assert.NotNull(@event.Contexts.OperatingSystem.Name);
49 | Assert.NotNull(@event.Contexts.OperatingSystem.Version);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Internals/NativeIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Forms.Testing.Mock;
2 | using Sentry.Xamarin.Internals;
3 | using System;
4 | using Xunit;
5 |
6 | namespace Sentry.Xamarin.Forms.UWP.Tests.Internals
7 | {
8 | public class NativeIntegrationTests
9 | {
10 | ///
11 | /// Mock is not supported by .NET Native so we have to manually Mock the Hub.
12 | ///
13 |
14 | [Fact]
15 | public void Unregister_DoesntCrashifNotRegistered()
16 | {
17 | //Arrange
18 | var integration = new NativeIntegration(new SentryXamarinOptions());
19 |
20 | //Act
21 | integration.Unregister();
22 | }
23 |
24 | [Fact]
25 | public void Handle_RegisterUnhandleException()
26 | {
27 | //Arrange
28 | var integration = new NativeIntegration(new SentryXamarinOptions());
29 | var hub = new MockHub();
30 |
31 | integration.Register(hub, new SentryOptions());
32 |
33 | //Act
34 | try
35 | {
36 | integration.Handle(new Exception());
37 | }
38 | finally
39 | {
40 | integration.Unregister();
41 | }
42 |
43 | //Assert
44 | Assert.Equal(1, hub.CaptureEventCount);
45 | Assert.Equal(1, hub.FlushAsyncCount);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Internals/XamarinEventProcessorTests.cs:
--------------------------------------------------------------------------------
1 | using Sentry.Xamarin.Internals;
2 | using Xunit;
3 |
4 | namespace Sentry.Xamarin.Forms.UWP.Tests.Internals
5 | {
6 | public class XamarinEventProcessorTests
7 | {
8 | [Fact]
9 | public void Register_ValidEvent_EventWithOperationalSystemInfo()
10 | {
11 |
12 | //Arrange
13 | var eventProcessor = new XamarinEventProcessor(new SentryXamarinOptions());
14 | var @event = new SentryEvent();
15 |
16 | //Act
17 | @event = eventProcessor.Process(@event);
18 |
19 | //Assert
20 | Assert.NotNull(@event.Contexts.OperatingSystem.Name);
21 | Assert.NotNull(@event.Contexts.OperatingSystem.Version);
22 | }
23 |
24 | [Fact]
25 | public void Register_ValidEvent_EventWithDeviceInfoSet()
26 | {
27 |
28 | //Arrange
29 | var eventProcessor = new XamarinEventProcessor(new SentryXamarinOptions());
30 | var @event = new SentryEvent();
31 |
32 | //Act
33 | @event = eventProcessor.Process(@event);
34 |
35 | //Assert
36 | Assert.NotNull(@event.Contexts.Device.Simulator);
37 | Assert.NotNull(@event.Contexts.Device.Model);
38 | Assert.NotNull(@event.Contexts.Device.Brand);
39 | }
40 |
41 | [Fact]
42 | public void Register_ValidEvent_OSNameIsUWP()
43 | {
44 | //Arrange
45 | var eventProcessor = new XamarinEventProcessor(new SentryXamarinOptions());
46 |
47 | //Act
48 | var @event = eventProcessor.Process(new SentryEvent());
49 |
50 | //Assert
51 | Assert.Equal("UWP", @event.Contexts.OperatingSystem.Name);
52 | }
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
13 |
14 |
15 | Sentry.Xamarin.Forms.Tests.UWP
16 | lucas
17 | Assets\StoreLogo.png
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("Sentry.Xamarin.Forms.UWP.Tests")]
5 | [assembly: AssemblyDescription("")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("")]
8 | [assembly: AssemblyProduct("Sentry.Xamarin.Forms.UWP.Tests")]
9 | [assembly: AssemblyCopyright("Copyright © 2020")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 | [assembly: AssemblyMetadata("TargetPlatform", "UAP")]
13 |
14 | // [assembly: AssemblyVersion("1.0.*")]
15 | [assembly: AssemblyVersion("1.0.0.0")]
16 | [assembly: AssemblyFileVersion("1.0.0.0")]
17 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Sentry.Xamarin.Forms.Tests.UWP.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework =
3 | build_property.TargetPlatformMinVersion = 10.0.16299.0
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids = {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
6 | build_property.PublishSingleFile =
7 | build_property.IncludeAllContentForSelfExtract =
8 | build_property._SupportedPlatformList =
9 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/Sentry.Xamarin.Forms.UWP.Tests.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework =
3 | build_property.TargetPlatformMinVersion = 10.0.16299.0
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids = {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
6 | build_property.PublishSingleFile =
7 | build_property.IncludeAllContentForSelfExtract =
8 | build_property._SupportedPlatformList =
9 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/SentryXamarinIntegrationTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace Sentry.Xamarin.Forms.UWP.Tests
4 | {
5 | public class SentryXamarinIntegrationTests
6 | {
7 | [Fact]
8 | public void RegisterNativeIntegrations_NativeIntegrationEnabled_NativeIntegrationRegistered()
9 | {
10 | //Arrange
11 | var xamarinOptions = new SentryXamarinOptions()
12 | {
13 | NativeIntegrationEnabled = true
14 | };
15 |
16 | //Act
17 | var registered = xamarinOptions.RegisterNativeIntegrations();
18 |
19 | //Assert
20 | Assert.True(registered);
21 | }
22 |
23 | [Fact]
24 | public void RegisterNativeIntegrations_NativeIntegrationDisabled_NativeIntegrationNotSet()
25 | {
26 | //Arrange
27 | var xamarinOptions = new SentryXamarinOptions()
28 | {
29 | NativeIntegrationEnabled = false
30 | };
31 |
32 | //Act
33 | var registered = xamarinOptions.RegisterNativeIntegrations();
34 |
35 | //Assert
36 | Assert.False(registered);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Forms.UWP.Tests/UnitTestApp.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Tests/Extensions/SentryXamarinOptionsExtensionsTests.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace Sentry.Xamarin.Tests.Extensions
4 | {
5 | public class SentryXamarinOptionsExtensionsTests
6 | {
7 |
8 | [InlineData("https://5a193123a9b841bc8d8e42531e7242a1@sentry.io/5560112", "https://5a193123a9b841bc8d8e42531e7242a1@sentry.io/5560112")]
9 | [InlineData("https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112", "https://5a193123a9b841bc8d8e42531e7242a1@sentry.io/5560112")]
10 | [InlineData("https://5a193123a9b841bc8d8e42531e7242a1@aliens.ufo/5560112", "https://5a193123a9b841bc8d8e42531e7242a1@aliens.ufo/5560112")]
11 | [InlineData("badDsn", "badDsn")]
12 | [InlineData(null, null)]
13 | [Theory]
14 | public void AdjustSaasDsn_AndroidDsn_AlternativeDsnSet(string dsn, string expectedDsn)
15 | {
16 | // Arrange
17 | var options = new SentryXamarinOptions()
18 | {
19 | Dsn = dsn
20 | };
21 |
22 | // Act
23 | options.AdjustSaasDsn();
24 |
25 | // Assert
26 | Assert.Equal(expectedDsn, options.Dsn);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Tests/Sentry.Xamarin.Tests/Sentry.Xamarin.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp3.1
4 | false
5 |
6 | true
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/dangerfile.js:
--------------------------------------------------------------------------------
1 | const PR_LINK = `([#${danger.github.pr.number}](${danger.github.pr.html_url}))`;
2 |
3 | const CHANGELOG_SUMMARY_TITLE = `Instructions and example for changelog`;
4 | const CHANGELOG_BODY = `Please add an entry to \`CHANGELOG.md\` to the "Unreleased" section. Make sure the entry includes this PR's number.
5 |
6 | Example:`;
7 |
8 | const CHANGELOG_END_BODY = `If none of the above apply, you can opt out of this check by adding \`#skip-changelog\` to the PR description.`;
9 |
10 | function getCleanTitleWithPrLink() {
11 | const title = danger.github.pr.title;
12 | return title.split(": ").slice(-1)[0].trim().replace(/\.+$/, "") + ` ` + PR_LINK;
13 | }
14 |
15 | function getChangelogDetailsHtml() {
16 | return `
17 | ### ${CHANGELOG_SUMMARY_TITLE}
18 |
19 | ${CHANGELOG_BODY}
20 |
21 | \`\`\`markdown
22 | - ${getCleanTitleWithPrLink()}
23 | \`\`\`
24 |
25 | ${CHANGELOG_END_BODY}
26 | `;
27 | }
28 |
29 | function getChangelogDetailsTxt() {
30 | return (
31 | CHANGELOG_SUMMARY_TITLE +
32 | "\n" +
33 | CHANGELOG_BODY +
34 | "\n" +
35 | getCleanTitleWithPrLink() +
36 | "\n" +
37 | CHANGELOG_END_BODY
38 | );
39 | }
40 |
41 | function HasPermissionToComment() {
42 | return (
43 | danger.github.pr.head.repo.git_url == danger.github.pr.base.repo.git_url
44 | );
45 | }
46 |
47 | async function containsChangelog(path) {
48 | const contents = await danger.github.utils.fileContents(path);
49 | return contents.includes(PR_LINK);
50 | }
51 |
52 | async function checkChangelog() {
53 | const skipChangelog =
54 | danger.github && (danger.github.pr.body + "").toLowerCase().includes("#skip-changelog");
55 | if (skipChangelog) {
56 | return;
57 | }
58 |
59 | const hasChangelog = await containsChangelog("CHANGELOG.md");
60 |
61 | if (!hasChangelog) {
62 | if (HasPermissionToComment()) {
63 | fail("Please consider adding a changelog entry for the next release.");
64 | markdown(getChangelogDetailsHtml());
65 | } else {
66 | //Fallback
67 | console.log(
68 | "Please consider adding a changelog entry for the next release."
69 | );
70 | console.log(getChangelogDetailsTxt());
71 | process.exitCode = 1;
72 | }
73 | }
74 | }
75 |
76 | async function checkIfFeature() {
77 | const title = danger.github.pr.title;
78 | if (title.startsWith("feat:") && HasPermissionToComment()) {
79 | message(
80 | 'Do not forget to update Sentry-docs with your feature once the pull request gets approved.'
81 | );
82 | }
83 | }
84 |
85 | async function checkAll() {
86 | // See: https://spectrum.chat/danger/javascript/support-for-github-draft-prs~82948576-ce84-40e7-a043-7675e5bf5690
87 | const isDraft = danger.github.pr.mergeable_state === "draft";
88 |
89 | if (isDraft) {
90 | return;
91 | }
92 |
93 | await checkIfFeature();
94 | await checkChangelog();
95 | }
96 |
97 | schedule(checkAll);
98 |
--------------------------------------------------------------------------------
/scripts/bump-version.ps1:
--------------------------------------------------------------------------------
1 | param([string] $newVersion)
2 |
3 | $utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False)
4 | function Replace-TextInFile {
5 | param([string] $filePath, [string] $pattern, [string] $replacement)
6 |
7 | $content = [IO.File]::ReadAllText($filePath)
8 | $content = [Text.RegularExpressions.Regex]::Replace($content, $pattern, $replacement)
9 | [IO.File]::WriteAllText($filePath, $content, $utf8NoBomEncoding)
10 | }
11 |
12 | # Version of .NET assemblies:
13 | Replace-TextInFile "$PSScriptRoot/../Directory.Build.props" '(?<=)(.*?)(?=)' $newVersion
14 | # Version of the UPM package
15 | Replace-TextInFile "$PSScriptRoot/../package/package.json" '(?<="version": ")(.*?)(?=")' $newVersion
16 | # Bump the version on the repository README and the UPM's README:
17 | Replace-TextInFile "$PSScriptRoot/../package/README.md" '(?<=git#)(.+)' $newVersion
18 | Replace-TextInFile "$PSScriptRoot/../README.md" '(?<=git#)(.+)' $newVersion
19 |
--------------------------------------------------------------------------------
/scripts/bump-version.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -eux
4 |
5 | # Requires powershell: `brew install powershell`
6 | # craft executes this file by convension, passing the new version as the second argument:
7 | pwsh ./scripts/bump-version.ps1 $2
8 |
--------------------------------------------------------------------------------