Skip to content

Commit 495e742

Browse files
authored
fix: Renamed ISession to ISentrySession (#3110)
* renamed ISession to ISentrySession * Updated CHANGELOG.md * renamed session as well * Updated CHANGELOG.md * verify * Updated CHANGELOG.md
1 parent 66920cd commit 495e742

14 files changed

+107
-101
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Unreleased
44

5+
### Fixes
6+
7+
- To resolve conflicting types due to the SDK adding itself to the global usings:
8+
- The interface `Sentry.ISession` has been renamed to `Sentry.ISentrySession`
9+
- The class `Sentry.Session` has been renamed to `Sentry.SentrySession` ([#3110](https://github.com/getsentry/sentry-dotnet/pull/3110))
10+
511
### Dependencies
612

713
- Bump Cocoa SDK from v8.19.0 to v8.20.0 ([#3107](https://github.com/getsentry/sentry-dotnet/pull/3107))

src/Sentry/GlobalSessionManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ internal class GlobalSessionManager : ISessionManager
1919
private readonly string? _persistenceDirectoryPath;
2020

2121
private string? _resolvedInstallationId;
22-
private Session? _currentSession;
22+
private SentrySession? _currentSession;
2323
private DateTimeOffset? _lastPauseTimestamp;
2424

2525
// Internal for testing
26-
internal Session? CurrentSession => _currentSession;
26+
internal SentrySession? CurrentSession => _currentSession;
2727

2828
public bool IsSessionActive => _currentSession is not null;
2929

@@ -308,7 +308,7 @@ private void DeletePersistedSession()
308308
var distinctId = TryGetInstallationId();
309309

310310
// Create new session
311-
var session = new Session(distinctId, release, environment);
311+
var session = new SentrySession(distinctId, release, environment);
312312

313313
// Set new session and check whether we ended up overwriting an active one in the process
314314
var previousSession = Interlocked.Exchange(ref _currentSession, session);
@@ -329,7 +329,7 @@ private void DeletePersistedSession()
329329
return update;
330330
}
331331

332-
private SessionUpdate EndSession(Session session, DateTimeOffset timestamp, SessionEndStatus status)
332+
private SessionUpdate EndSession(SentrySession session, DateTimeOffset timestamp, SessionEndStatus status)
333333
{
334334
if (status == SessionEndStatus.Crashed)
335335
{

src/Sentry/ISession.cs renamed to src/Sentry/ISentrySession.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Sentry;
33
/// <summary>
44
/// Session metadata.
55
/// </summary>
6-
public interface ISession
6+
public interface ISentrySession
77
{
88
/// <summary>
99
/// Session auto-generated ID.

src/Sentry/Session.cs renamed to src/Sentry/SentrySession.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace Sentry;
44
/// Sentry session.
55
/// </summary>
66
// https://develop.sentry.dev/sdk/sessions
7-
public class Session : ISession
7+
public class SentrySession : ISentrySession
88
{
99
/// <inheritdoc />
1010
public SentryId Id { get; }
@@ -36,7 +36,7 @@ public class Session : ISession
3636
// Start at -1 so that the first increment puts it at 0
3737
private int _sequenceNumber = -1;
3838

39-
internal Session(
39+
internal SentrySession(
4040
SentryId id,
4141
string? distinctId,
4242
DateTimeOffset startTimestamp,
@@ -55,9 +55,9 @@ internal Session(
5555
}
5656

5757
/// <summary>
58-
/// Initializes a new instance of <see cref="Session"/>.
58+
/// Initializes a new instance of <see cref="SentrySession"/>.
5959
/// </summary>
60-
public Session(string? distinctId, string release, string? environment)
60+
public SentrySession(string? distinctId, string release, string? environment)
6161
: this(
6262
SentryId.Create(),
6363
distinctId,

src/Sentry/SessionUpdate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Sentry;
77
/// Session update.
88
/// </summary>
99
// https://develop.sentry.dev/sdk/sessions/#session-update-payload
10-
public class SessionUpdate : ISession, IJsonSerializable
10+
public class SessionUpdate : ISentrySession, IJsonSerializable
1111
{
1212
/// <inheritdoc />
1313
public SentryId Id { get; }
@@ -93,7 +93,7 @@ public SessionUpdate(
9393
/// Initializes a new instance of <see cref="SessionUpdate"/>.
9494
/// </summary>
9595
public SessionUpdate(
96-
ISession session,
96+
ISentrySession session,
9797
bool isInitial,
9898
DateTimeOffset timestamp,
9999
int sequenceNumber,

test/Sentry.Tests/ApiApprovalTests.Run.DotNet6_0.verified.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,7 @@ namespace Sentry
302302
{
303303
void Apply(Sentry.Scope scope, object state);
304304
}
305-
public interface ISentryUserFactory
306-
{
307-
Sentry.SentryUser? Create();
308-
}
309-
public interface ISession
305+
public interface ISentrySession
310306
{
311307
string? DistinctId { get; }
312308
string? Environment { get; }
@@ -317,6 +313,10 @@ namespace Sentry
317313
System.DateTimeOffset StartTimestamp { get; }
318314
string? UserAgent { get; }
319315
}
316+
public interface ISentryUserFactory
317+
{
318+
Sentry.SentryUser? Create();
319+
}
320320
public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext
321321
{
322322
new string? Description { get; set; }
@@ -792,6 +792,19 @@ namespace Sentry
792792
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { }
793793
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { }
794794
}
795+
public class SentrySession : Sentry.ISentrySession
796+
{
797+
public SentrySession(string? distinctId, string release, string? environment) { }
798+
public string? DistinctId { get; }
799+
public string? Environment { get; }
800+
public int ErrorCount { get; }
801+
public Sentry.SentryId Id { get; }
802+
public string? IpAddress { get; }
803+
public string Release { get; }
804+
public System.DateTimeOffset StartTimestamp { get; }
805+
public string? UserAgent { get; }
806+
public void ReportError() { }
807+
}
795808
public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext
796809
{
797810
public SentrySpan(Sentry.ISpan tracer) { }
@@ -928,30 +941,17 @@ namespace Sentry
928941
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { }
929942
public static Sentry.SentryUser FromJson(System.Text.Json.JsonElement json) { }
930943
}
931-
public class Session : Sentry.ISession
932-
{
933-
public Session(string? distinctId, string release, string? environment) { }
934-
public string? DistinctId { get; }
935-
public string? Environment { get; }
936-
public int ErrorCount { get; }
937-
public Sentry.SentryId Id { get; }
938-
public string? IpAddress { get; }
939-
public string Release { get; }
940-
public System.DateTimeOffset StartTimestamp { get; }
941-
public string? UserAgent { get; }
942-
public void ReportError() { }
943-
}
944944
public enum SessionEndStatus
945945
{
946946
Exited = 0,
947947
Crashed = 1,
948948
Abnormal = 2,
949949
}
950-
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISession
950+
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession
951951
{
952952
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { }
953953
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { }
954-
public SessionUpdate(Sentry.ISession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
954+
public SessionUpdate(Sentry.ISentrySession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
955955
public SessionUpdate(Sentry.SentryId id, string? distinctId, System.DateTimeOffset startTimestamp, string release, string? environment, string? ipAddress, string? userAgent, int errorCount, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
956956
public string? DistinctId { get; }
957957
public System.TimeSpan Duration { get; }

test/Sentry.Tests/ApiApprovalTests.Run.DotNet7_0.verified.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,7 @@ namespace Sentry
302302
{
303303
void Apply(Sentry.Scope scope, object state);
304304
}
305-
public interface ISentryUserFactory
306-
{
307-
Sentry.SentryUser? Create();
308-
}
309-
public interface ISession
305+
public interface ISentrySession
310306
{
311307
string? DistinctId { get; }
312308
string? Environment { get; }
@@ -317,6 +313,10 @@ namespace Sentry
317313
System.DateTimeOffset StartTimestamp { get; }
318314
string? UserAgent { get; }
319315
}
316+
public interface ISentryUserFactory
317+
{
318+
Sentry.SentryUser? Create();
319+
}
320320
public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext
321321
{
322322
new string? Description { get; set; }
@@ -792,6 +792,19 @@ namespace Sentry
792792
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { }
793793
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { }
794794
}
795+
public class SentrySession : Sentry.ISentrySession
796+
{
797+
public SentrySession(string? distinctId, string release, string? environment) { }
798+
public string? DistinctId { get; }
799+
public string? Environment { get; }
800+
public int ErrorCount { get; }
801+
public Sentry.SentryId Id { get; }
802+
public string? IpAddress { get; }
803+
public string Release { get; }
804+
public System.DateTimeOffset StartTimestamp { get; }
805+
public string? UserAgent { get; }
806+
public void ReportError() { }
807+
}
795808
public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext
796809
{
797810
public SentrySpan(Sentry.ISpan tracer) { }
@@ -928,30 +941,17 @@ namespace Sentry
928941
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { }
929942
public static Sentry.SentryUser FromJson(System.Text.Json.JsonElement json) { }
930943
}
931-
public class Session : Sentry.ISession
932-
{
933-
public Session(string? distinctId, string release, string? environment) { }
934-
public string? DistinctId { get; }
935-
public string? Environment { get; }
936-
public int ErrorCount { get; }
937-
public Sentry.SentryId Id { get; }
938-
public string? IpAddress { get; }
939-
public string Release { get; }
940-
public System.DateTimeOffset StartTimestamp { get; }
941-
public string? UserAgent { get; }
942-
public void ReportError() { }
943-
}
944944
public enum SessionEndStatus
945945
{
946946
Exited = 0,
947947
Crashed = 1,
948948
Abnormal = 2,
949949
}
950-
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISession
950+
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession
951951
{
952952
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { }
953953
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { }
954-
public SessionUpdate(Sentry.ISession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
954+
public SessionUpdate(Sentry.ISentrySession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
955955
public SessionUpdate(Sentry.SentryId id, string? distinctId, System.DateTimeOffset startTimestamp, string release, string? environment, string? ipAddress, string? userAgent, int errorCount, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
956956
public string? DistinctId { get; }
957957
public System.TimeSpan Duration { get; }

test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,7 @@ namespace Sentry
303303
{
304304
void Apply(Sentry.Scope scope, object state);
305305
}
306-
public interface ISentryUserFactory
307-
{
308-
Sentry.SentryUser? Create();
309-
}
310-
public interface ISession
306+
public interface ISentrySession
311307
{
312308
string? DistinctId { get; }
313309
string? Environment { get; }
@@ -318,6 +314,10 @@ namespace Sentry
318314
System.DateTimeOffset StartTimestamp { get; }
319315
string? UserAgent { get; }
320316
}
317+
public interface ISentryUserFactory
318+
{
319+
Sentry.SentryUser? Create();
320+
}
321321
public interface ISpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.ISpanData, Sentry.Protocol.ITraceContext
322322
{
323323
new string? Description { get; set; }
@@ -794,6 +794,19 @@ namespace Sentry
794794
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, Sentry.SentryTraceHeader traceHeader) { }
795795
public static Sentry.ITransactionTracer StartTransaction(string name, string operation, string? description) { }
796796
}
797+
public class SentrySession : Sentry.ISentrySession
798+
{
799+
public SentrySession(string? distinctId, string release, string? environment) { }
800+
public string? DistinctId { get; }
801+
public string? Environment { get; }
802+
public int ErrorCount { get; }
803+
public Sentry.SentryId Id { get; }
804+
public string? IpAddress { get; }
805+
public string Release { get; }
806+
public System.DateTimeOffset StartTimestamp { get; }
807+
public string? UserAgent { get; }
808+
public void ReportError() { }
809+
}
797810
public class SentrySpan : Sentry.IHasExtra, Sentry.IHasTags, Sentry.IJsonSerializable, Sentry.ISpanData, Sentry.Protocol.ITraceContext
798811
{
799812
public SentrySpan(Sentry.ISpan tracer) { }
@@ -930,30 +943,17 @@ namespace Sentry
930943
public void WriteTo(System.Text.Json.Utf8JsonWriter writer, Sentry.Extensibility.IDiagnosticLogger? _) { }
931944
public static Sentry.SentryUser FromJson(System.Text.Json.JsonElement json) { }
932945
}
933-
public class Session : Sentry.ISession
934-
{
935-
public Session(string? distinctId, string release, string? environment) { }
936-
public string? DistinctId { get; }
937-
public string? Environment { get; }
938-
public int ErrorCount { get; }
939-
public Sentry.SentryId Id { get; }
940-
public string? IpAddress { get; }
941-
public string Release { get; }
942-
public System.DateTimeOffset StartTimestamp { get; }
943-
public string? UserAgent { get; }
944-
public void ReportError() { }
945-
}
946946
public enum SessionEndStatus
947947
{
948948
Exited = 0,
949949
Crashed = 1,
950950
Abnormal = 2,
951951
}
952-
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISession
952+
public class SessionUpdate : Sentry.IJsonSerializable, Sentry.ISentrySession
953953
{
954954
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial) { }
955955
public SessionUpdate(Sentry.SessionUpdate sessionUpdate, bool isInitial, Sentry.SessionEndStatus? endStatus) { }
956-
public SessionUpdate(Sentry.ISession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
956+
public SessionUpdate(Sentry.ISentrySession session, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
957957
public SessionUpdate(Sentry.SentryId id, string? distinctId, System.DateTimeOffset startTimestamp, string release, string? environment, string? ipAddress, string? userAgent, int errorCount, bool isInitial, System.DateTimeOffset timestamp, int sequenceNumber, Sentry.SessionEndStatus? endStatus) { }
958958
public string? DistinctId { get; }
959959
public System.TimeSpan Duration { get; }

0 commit comments

Comments
 (0)