-
-
Notifications
You must be signed in to change notification settings - Fork 120
Conversation
bruno-garcia
commented
Apr 18, 2018
- Payload creating has runtime detection
- Context is built lazily on first event
- Root context is closed per event to avoid sys calls required to build it
- .NET Framework 4.7.1 added to support NET Standard 2.0 paths (RuntimeInformation)
- Warnings over obsolete calls removed from test projects
- Nancy targets net471 also
- Json.NET indirect reference to Nancy
* Context is built lazily on first event * Root context is closed per event to avoid sys calls required to build it * .NET Framework 4.7.1 added to support NET Standar 2.0 paths (RuntimeInformation)
* Warnings over obsolete calls removed from test projects * Nancy targets net471 also * Json.NET indirect reference to Nancy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this. Note that to be fully API compatible, contexts could theoretically be renamed, for example:
{
"runtime": {
"name": ".NET Framework"
},
"asp": {
"type": "runtime",
"name": "ASP.NET"
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great additions. I only have a few minor comments.
app.Version = asm.Version?.ToString(); | ||
} | ||
|
||
using (var proc = Process.GetCurrentProcess()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it wise to .Dispose()
the current process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This instance was created by me at this location and should be disposed when not needed.
/// Retrieves the architecture of this device. | ||
/// </summary> | ||
/// <returns>Arch or null if unknown</returns> | ||
internal static string GetArchitecture() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these internal
methods only seem to be used in a private
scope, so can they be changed to private
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I made them internal for testing but I'm just covering them through testing the whole Device at the end. I'll make them private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually used by tests*
/// <seealso href="https://docs.sentry.io/clientdev/interfaces/contexts/"/> | ||
public Contexts Contexts | ||
{ | ||
get { return this.contexts; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just add an internal set;
to this property so we get rid of the field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
return entryMethod?.Module?.Assembly?.GetName(); | ||
} | ||
|
||
internal static MethodBase GetApplicationEntryMethod() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if (displayName != null) | ||
{ | ||
monoVersion = displayName.Invoke(null, null) as string; | ||
if (monoVersion != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't all of these null
checks be collapsed into a chained null
propagation (?.
) expression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was afraid it'd be less readable but looks fine. Will change.
{ | ||
var sut = App.Create(); | ||
|
||
Assert.True(sut.StartTime.HasValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Assert.That(app.StartTime.HasValue, Is.True)
reads better.
var sut = App.Create(); | ||
|
||
Assert.True(sut.StartTime.HasValue); | ||
Assert.AreNotEqual(default(DateTimeOffset), sut.StartTime.Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Assert.That(app.StartTime.Value, Is.Not.EqualTo(default(DateTimeOffset))
reads better.
|
||
Assert.True(sut.StartTime.HasValue); | ||
Assert.AreNotEqual(default(DateTimeOffset), sut.StartTime.Value); | ||
Assert.Greater(DateTimeOffset.UtcNow, sut.StartTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Assert.That(app.StartTime, Is.GreaterThan(DateTimeOffset.UtcNow))
reads better.
{ | ||
var sut = App.Create(); | ||
|
||
Assert.NotNull(sut.Version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Assert.That(app.Version, Is.Not.Null)
reads better.
Assert.That(actual, Is.EqualTo(@case.ExpectedSerializationOutput)); | ||
} | ||
|
||
public static IEnumerable<object[]> TestCases() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@asbjornu could you please check again? |
@bruno-garcia: |
@asbjornu I commented on the review: It's to be accessed by the Unit testing library. |
@asbjornu if that's ok, could you please approve it? Thanks! |