Skip to content

Commit

Permalink
Merge branch 'main' into ref-avoid-parsing-text-as-json-http
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-zimerman authored Dec 28, 2020
2 parents 4e2583c + 0847ae3 commit eab3e84
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Handle non-json error response messages on HttpTransport. (#690) @lucas-zimerman
- Fix deadlock on missing ConfigureAwait into foreach loops. (#694) @lucas-zimerman

## 3.0.0-alpha.8

Expand All @@ -14,6 +15,7 @@
- Add support for attachments. (#670) @Tyrrrz
- Improve logging for relay errors. (#683) @Tyrrrz
- Report sentry.dotnet.aspnet on the new Sentry.AspNet package. (#681) @Tyrrrz
- Always send a default release. (#695) @Tyrrrz

## 3.0.0-alpha.7

Expand Down
17 changes: 8 additions & 9 deletions src/Sentry/Internal/ApplicationVersionLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ internal static class ApplicationVersionLocator
return null;
}

var version = asm.GetNameAndVersion().Version;
var nameAndVersion = asm.GetNameAndVersion();

return !string.IsNullOrEmpty(version)
// If it really was on of the following, app would need to be set explicitly since these are defaults.
&& version != "0.0.0"
&& version != "1.0.0"
&& version != "0.0.0.0"
&& version != "1.0.0.0"
? $"{asm.GetName().Name}@{version}"
: null;
if (string.IsNullOrWhiteSpace(nameAndVersion.Name) ||
string.IsNullOrWhiteSpace(nameAndVersion.Version))
{
return null;
}

return $"{nameAndVersion.Name}@{nameAndVersion.Version}";
}
}
}
2 changes: 1 addition & 1 deletion src/Sentry/Protocol/Envelopes/Envelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public static Envelope FromTransaction(Transaction transaction)
var buffer = new List<byte>();

var prevByte = default(int);
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken))
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken).ConfigureAwait(false))
{
// Break if found an unescaped newline
if (curByte == '\n' && prevByte != '\\')
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/Protocol/Envelopes/EnvelopeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public static EnvelopeItem FromAttachment(Attachment attachment)
var buffer = new List<byte>();

var prevByte = default(int);
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken))
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken).ConfigureAwait(false))
{
// Break if found an unescaped newline
if (curByte == '\n' && prevByte != '\\')
Expand Down Expand Up @@ -270,7 +270,7 @@ public static async Task<EnvelopeItem> DeserializeAsync(
var payload = await DeserializePayloadAsync(stream, header, cancellationToken).ConfigureAwait(false);

// Swallow trailing newlines (some envelopes may have them after payloads)
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken))
await foreach (var curByte in stream.ReadAllBytesAsync(cancellationToken).ConfigureAwait(false))
{
if (curByte != '\n')
{
Expand Down
4 changes: 0 additions & 4 deletions test/Sentry.Tests/Internals/ApplicationVersionLocatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ public void GetCurrent_ValidVersion_ReturnsVersion(string expectedVersion)

[Theory]
[InlineData("")]
[InlineData("0.0.0")]
[InlineData("1.0.0")]
[InlineData("0.0.0.0")]
[InlineData("1.0.0.0")]
public void GetCurrent_InvalidCases_ReturnsNull(string version)
{
var asm = AssemblyCreationHelper.CreateWithInformationalVersion(version);
Expand Down

0 comments on commit eab3e84

Please sign in to comment.