Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Sentry/IScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public interface IScopeObserver
/// </summary>
public void SetTrace(SentryId traceId, SpanId parentSpanId);

/// <summary>
/// Sets the environment.
/// </summary>
Comment thread
sentry-warden[bot] marked this conversation as resolved.
public void SetEnvironment(string? environment);
Comment thread
bitsandfoxes marked this conversation as resolved.

/// <summary>
/// Adds an attachment.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions src/Sentry/Internal/ScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ public void SetTrace(SentryId traceId, SpanId parentSpanId)

public abstract void SetTraceImpl(SentryId traceId, SpanId parentSpanId);

public void SetEnvironment(string? environment)
{
_options.DiagnosticLogger?.Log(SentryLevel.Debug,
"{0} Scope Sync - Setting Environment e:\"{1}\"", null, _name, environment);
SetEnvironmentImpl(environment);
}

public abstract void SetEnvironmentImpl(string? environment);

public void AddAttachment(SentryAttachment attachment)
{
_options.DiagnosticLogger?.Log(SentryLevel.Debug,
Expand Down
12 changes: 12 additions & 0 deletions src/Sentry/Platforms/Android/AndroidScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ public void SetTrace(SentryId traceId, SpanId parentSpanId)
}
}

public void SetEnvironment(string? environment)
{
try
{
// TODO: Missing corresponding scope-level functionality on the Android SDK
}
finally
{
_innerObserver?.SetEnvironment(environment);
}
}

public void AddAttachment(SentryAttachment attachment)
{
try
Expand Down
12 changes: 12 additions & 0 deletions src/Sentry/Platforms/Cocoa/CocoaScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ public void SetTrace(SentryId traceId, SpanId parentSpanId)
}
}

public void SetEnvironment(string? environment)
{
try
{
SentryCocoaSdk.ConfigureScope(scope => scope.SetEnvironment(environment));
}
finally
{
_innerObserver?.SetEnvironment(environment);
}
}

public void AddAttachment(SentryAttachment attachment)
{
try
Expand Down
3 changes: 3 additions & 0 deletions src/Sentry/Platforms/Native/CFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ internal static string GetCacheDirectory(SentryOptions options)
[DllImport("sentry-native")]
internal static extern void sentry_set_trace(string traceId, string parentSpanId);

[DllImport("sentry-native")]
internal static extern void sentry_set_environment(string? environment);

Comment thread
bitsandfoxes marked this conversation as resolved.
internal static Dictionary<long, DebugImage> LoadDebugImages(IDiagnosticLogger? logger)
{
// It only makes sense to load them once because they're cached on the native side anyway. We could force
Expand Down
3 changes: 3 additions & 0 deletions src/Sentry/Platforms/Native/NativeScopeObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public override void SetUserImpl(SentryUser user)
public override void SetTraceImpl(SentryId traceId, SpanId parentSpanId) =>
C.sentry_set_trace(traceId.ToString(), parentSpanId.ToString());

public override void SetEnvironmentImpl(string? environment) =>
C.sentry_set_environment(environment);
Comment thread
bitsandfoxes marked this conversation as resolved.

public override void AddAttachmentImpl(SentryAttachment attachment)
{
// TODO: Missing corresponding functionality on the Native SDK
Expand Down
19 changes: 18 additions & 1 deletion src/Sentry/Scope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,25 @@ public SentryUser User
/// <inheritdoc />
public string? Distribution { get; set; }

private string? _environment;
Comment thread
bitsandfoxes marked this conversation as resolved.
Outdated

/// <inheritdoc />
public string? Environment { get; set; }
public string? Environment
Comment thread
jamescrosswell marked this conversation as resolved.
{
get => _environment;
set
Comment thread
bitsandfoxes marked this conversation as resolved.
{
if (_environment != value)
{
_environment = value;
if (Options.EnableScopeSync &&
Options.ScopeObserver is { } observer)
{
observer.SetEnvironment(value);
}
}
Comment thread
bitsandfoxes marked this conversation as resolved.
}
}
Comment thread
bitsandfoxes marked this conversation as resolved.

// TransactionName is kept for legacy purposes because
// SentryEvent still makes use of it.
Expand Down
63 changes: 63 additions & 0 deletions test/Sentry.Tests/ScopeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,69 @@
observer.Received(expectedCount).AddBreadcrumb(Arg.Is(breadcrumb));
}

[Theory]
[InlineData(true)]
[InlineData(false)]
public void SetEnvironment_ObserverExist_ObserverSetsEnvironmentIfEnabled(bool observerEnable)
{
// Arrange
var observer = Substitute.For<IScopeObserver>();
var scope = new Scope(new SentryOptions
{
ScopeObserver = observer,
EnableScopeSync = observerEnable
});
var expectedEnvironment = "staging";
var expectedCount = observerEnable ? 1 : 0;

// Act
scope.Environment = expectedEnvironment;

// Assert
observer.Received(expectedCount).SetEnvironment(Arg.Is(expectedEnvironment));
}

[Fact]
public void SetEnvironment_Null_ObserverClearsEnvironment()
{
// Arrange
var observer = Substitute.For<IScopeObserver>();
var scope = new Scope(new SentryOptions
{
ScopeObserver = observer,
EnableScopeSync = true
})
{
Environment = "staging"
};
observer.ClearReceivedCalls();

// Act
scope.Environment = null;

// Assert
observer.Received(1).SetEnvironment(Arg.Is((string?)null));

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Build (net9.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Build (net10.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Build (net10.0)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-musl-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / ios-tests

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / ios-tests

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (linux-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (win-arm64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / MSBuild

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (win-x64)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check failure on line 740 in test/Sentry.Tests/ScopeTests.cs

View workflow job for this annotation

GitHub Actions / Run API Approval Tests (macos)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
}

[Fact]
public void SetEnvironment_SameValue_ObserverNotifiedOnce()
{
// Arrange
var observer = Substitute.For<IScopeObserver>();
var scope = new Scope(new SentryOptions
{
ScopeObserver = observer,
EnableScopeSync = true
});

// Act
scope.Environment = "staging";
scope.Environment = "staging";

// Assert
observer.Received(1).SetEnvironment(Arg.Is("staging"));
}

[Fact]
public void Filtered_tags_are_not_set()
{
Expand Down
Loading