Skip to content

Commit 9daa168

Browse files
committed
Merge branch 'main' into 2927-aot_buildvars_sourcegen
2 parents ab5aa3a + 39e58f0 commit 9daa168

File tree

16 files changed

+133
-6
lines changed

16 files changed

+133
-6
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Features
88

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

1112
### Fixes

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
@@ -482,6 +482,13 @@ public static SentryId CaptureMessage(string message, SentryLevel level = Sentry
482482
public static SentryId CaptureMessage(string message, Action<Scope> configureScope, SentryLevel level = SentryLevel.Info)
483483
=> CurrentHub.CaptureMessage(message, configureScope, level);
484484

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

test/Sentry.Maui.Tests/Sentry.Maui.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<ProjectReference Include="..\Sentry.Testing\Sentry.Testing.csproj" />
1414
</ItemGroup>
1515

16-
<ItemGroup Condition="$(TargetFramework.StartsWith('net8'))">
16+
<ItemGroup Condition="$(TargetFramework.StartsWith('net8'))">
1717
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
1818
</ItemGroup>
1919

20-
<ItemGroup Condition="$(TargetFramework.StartsWith('net9'))">
20+
<ItemGroup Condition="$(TargetFramework.StartsWith('net9'))">
2121
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
2222
</ItemGroup>
2323

0 commit comments

Comments
 (0)