Skip to content

Commit 4f69fde

Browse files
committed
Merge branch 'main' into maui_mem_leak_fix
2 parents 9b630b8 + 8978bc4 commit 4f69fde

File tree

17 files changed

+135
-7
lines changed

17 files changed

+135
-7
lines changed

.github/actions/environment/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ runs:
6464
6565
- name: Install .NET Workloads
6666
shell: bash
67-
run: >
67+
run: |
68+
pwd
6869
dotnet workload install \
6970
wasm-tools wasm-tools-net8 maui-android \
7071
${{ runner.os == 'macOS' && 'maui-ios maui-maccatalyst maui-windows macos' || '' }} \

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
### Features
66

7+
- Added `CaptureFeedback` overload with `configureScope` parameter ([#4073](https://github.com/getsentry/sentry-dotnet/pull/4073))
78
- Custom SessionReplay masks in MAUI Android apps ([#4121](https://github.com/getsentry/sentry-dotnet/pull/4121))
89

910
### Fixes
1011

1112
- Work around iOS SHA1 bug ([#4143](https://github.com/getsentry/sentry-dotnet/pull/4143))
1213
- Prevent Auto Breadcrumbs Event Binder from leaking and rebinding events ([#4159](https://github.com/getsentry/sentry-dotnet/pull/4159))
14+
- Fixes build error when building .NET Framework applications using Sentry 5.6.0: `MSB4185 :The function "IsWindows" on type "System.OperatingSystem" is not available` ([#4160](https://github.com/getsentry/sentry-dotnet/pull/4160))
1315

1416
### Dependencies
1517

global.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"sdk": {
33
"version": "9.0.203",
4+
"workloadVersion": "9.0.203",
45
"rollForward": "disable",
56
"allowPrerelease": false
67
}

samples/Sentry.Samples.AspNetCore.Mvc/Controllers/HomeController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public async Task<IActionResult> SubmitFeedback(FeedbackModel feedback)
202202
hint.AddAttachment(memoryStream.ToArray(), feedback.Screenshot.FileName, AttachmentType.Default, "image/png");
203203
}
204204

205-
SentrySdk.CaptureFeedback(sentryFeedback, null, hint);
205+
SentrySdk.CaptureFeedback(sentryFeedback, hint: hint);
206206
ViewBag.Message = "Feedback submitted successfully!";
207207
return View("Index");
208208
}

src/Sentry/Extensibility/DisabledHub.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ public bool CaptureEnvelope(Envelope envelope)
147147
/// </summary>
148148
public SentryId CaptureEvent(SentryEvent evt, Scope? scope = null, SentryHint? hint = null) => SentryId.Empty;
149149

150+
/// <summary>
151+
/// No-Op.
152+
/// </summary>
153+
public void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null)
154+
{
155+
}
156+
150157
/// <summary>
151158
/// No-Op.
152159
/// </summary>

src/Sentry/Extensibility/HubAdapter.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ public SentryId CaptureEvent(SentryEvent evt, Scope? scope)
222222
public SentryId CaptureEvent(SentryEvent evt, Scope? scope, SentryHint? hint = null)
223223
=> SentrySdk.CaptureEvent(evt, scope, hint);
224224

225+
/// <summary>
226+
/// Forwards the call to <see cref="SentrySdk"/>.
227+
/// </summary>
228+
[DebuggerStepThrough]
229+
[EditorBrowsable(EditorBrowsableState.Never)]
230+
public void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null)
231+
=> SentrySdk.CaptureFeedback(feedback, configureScope, hint);
232+
225233
/// <summary>
226234
/// Forwards the call to <see cref="SentrySdk"/>.
227235
/// </summary>

src/Sentry/IHub.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,12 @@ public TransactionContext ContinueTrace(
116116
/// <param name="configureScope">The callback to configure the scope.</param>
117117
/// <returns></returns>
118118
public SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Action<Scope> configureScope);
119+
120+
/// <summary>
121+
/// Captures feedback from the user.
122+
/// </summary>
123+
/// <param name="feedback">The feedback to send to Sentry.</param>
124+
/// <param name="configureScope">Callback method to configure the scope.</param>
125+
/// <param name="hint">An optional hint providing high level context for the source of the event, including attachments</param>
126+
public void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null);
119127
}

src/Sentry/Internal/Hub.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,15 +506,42 @@ private SentryId CaptureEvent(SentryEvent evt, SentryHint? hint, Scope scope)
506506
}
507507
}
508508

509+
public void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null)
510+
{
511+
if (!IsEnabled)
512+
{
513+
return;
514+
}
515+
516+
try
517+
{
518+
var clonedScope = CurrentScope.Clone();
519+
configureScope(clonedScope);
520+
521+
CaptureFeedback(feedback, clonedScope, hint);
522+
}
523+
catch (Exception e)
524+
{
525+
_options.LogError(e, "Failure to capture feedback");
526+
}
527+
}
528+
509529
public void CaptureFeedback(SentryFeedback feedback, Scope? scope = null, SentryHint? hint = null)
510530
{
511531
if (!IsEnabled)
512532
{
513533
return;
514534
}
515535

516-
scope ??= CurrentScope;
517-
CurrentClient.CaptureFeedback(feedback, scope, hint);
536+
try
537+
{
538+
scope ??= CurrentScope;
539+
CurrentClient.CaptureFeedback(feedback, scope, hint);
540+
}
541+
catch (Exception e)
542+
{
543+
_options.LogError(e, "Failure to capture feedback");
544+
}
518545
}
519546

520547
#if MEMORY_DUMP_SUPPORTED

src/Sentry/SentrySdk.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,13 @@ public static SentryId CaptureMessage(string message, SentryLevel level = Sentry
481481
public static SentryId CaptureMessage(string message, Action<Scope> configureScope, SentryLevel level = SentryLevel.Info)
482482
=> CurrentHub.CaptureMessage(message, configureScope, level);
483483

484+
/// <summary>
485+
/// Captures feedback from the user.
486+
/// </summary>
487+
[DebuggerStepThrough]
488+
public static void CaptureFeedback(SentryFeedback feedback, Action<Scope> configureScope, SentryHint? hint = null)
489+
=> CurrentHub.CaptureFeedback(feedback, configureScope, hint);
490+
484491
/// <summary>
485492
/// Captures feedback from the user.
486493
/// </summary>

src/Sentry/buildTransitive/Sentry.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<Error Text="Android projects using Sentry cannot build using AndroidEnableAssemblyCompression = false due to a Microsoft issue. Please follow https://github.com/dotnet/android/issues/9752" />
1616
</Target>
1717

18-
<ItemGroup Condition="$([System.OperatingSystem]::IsWindows())">
18+
<ItemGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
1919
<!-- See: https://github.com/getsentry/sentry-dotnet/pull/4111 -->
2020
<LinkerArg Include="/NODEFAULTLIB:MSVCRT" />
2121
</ItemGroup>

0 commit comments

Comments
 (0)