Skip to content

Commit f7b7aeb

Browse files
Merge pull request #153 from bugsnag/release/3.0.0
Release 3.0.0
2 parents 4bd4acb + debfd1d commit f7b7aeb

File tree

11 files changed

+54
-24
lines changed

11 files changed

+54
-24
lines changed

Bugsnag.snk

596 Bytes
Binary file not shown.

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Changelog
22
=========
33

4+
## 3.0.0 (2022-01-31)
5+
6+
### Breaking Changes
7+
8+
The `Bugnsag.dll`, `Bugsnag.AspNet.dll`, `Bugsnag.AspNet.Mvc.dll` and `Bugsnag.AspNet.WebApi.dll` assemblies are now strong-name signed. The strong name key file `Bugsnag.snk` has been added to the repository. `Bugsnag.AspNet.Core.dll` remains unchanged. See the upgrade guide for more details.
9+
10+
### Bug fixes
11+
12+
* Strong name sign assemblies
13+
| [yousif-bugsnag](https://github.com/yousif-bugsnag)
14+
| [#151](https://github.com/bugsnag/bugsnag-dotnet/pull/151)
15+
16+
* Ensure breadcrumbs are returned in the correct order
17+
| [yousif-bugsnag](https://github.com/yousif-bugsnag)
18+
| [#150](https://github.com/bugsnag/bugsnag-dotnet/pull/150)
19+
420
## 2.2.3 (2021-09-06)
521

622
### Enhancements

Directory.build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<OutputPath>$(BaseOutputPath)</OutputPath>
4+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Bugsnag.snk</AssemblyOriginatorKeyFile>
5+
<SignAssembly>true</SignAssembly>
46
</PropertyGroup>
57
</Project>

UPGRADING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Upgrading
22
=========
33

4+
## 2.x to 3.x
5+
6+
If you are targeting .NET Framework, v3.0.0 contains binary breaking changes due to the introduction of strong name signing. You will need to re-compile your application against the new version. If you are referencing a library that also references Bugsnag you may also need to add a binding redirect or enable automatic binding redirection in your project file:
7+
8+
```
9+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
10+
```
11+
12+
.NET Core and .NET 5/6 do not recognise strong names so there is no action required if targetting one of those.
413
## 1.x to 2.x
514

615
*Our .NET notifier has gone through some major improvements, and there are some changes you'll need to make to get onto the new version.*

src/Bugsnag.AspNet.Core/Bugsnag.AspNet.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Title>Bugsnag .NET ASP.NET Core Notifier</Title>
55
<Description>The Bugsnag Notifier for ASP.NET Core gives you instant notification of exceptions thrown from your ASP.NET Core applications. Any uncaught exceptions will trigger a notification to be sent to your Bugsnag project.</Description>
66
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
7+
<SignAssembly>false</SignAssembly>
78
</PropertyGroup>
89
<ItemGroup>
910
<ProjectReference Include="..\Bugsnag\Bugsnag.csproj" />

src/Bugsnag/Breadcrumbs.cs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Bugsnag.Payload;
22
using System.Collections.Generic;
3+
using System.Linq;
34

45
namespace Bugsnag
56
{
@@ -43,8 +44,7 @@ public class Breadcrumbs : IBreadcrumbs
4344
{
4445
private readonly object _lock = new object();
4546
private readonly int _maximumBreadcrumbs;
46-
private readonly Breadcrumb[] _breadcrumbs;
47-
private int _current;
47+
private readonly LinkedList<Breadcrumb> _breadcrumbs;
4848

4949
/// <summary>
5050
/// Constructs a collection of breadcrumbs
@@ -53,8 +53,7 @@ public class Breadcrumbs : IBreadcrumbs
5353
public Breadcrumbs(IConfiguration configuration)
5454
{
5555
_maximumBreadcrumbs = configuration.MaximumBreadcrumbs;
56-
_current = 0;
57-
_breadcrumbs = new Breadcrumb[_maximumBreadcrumbs];
56+
_breadcrumbs = new LinkedList<Breadcrumb>();
5857
}
5958

6059
/// <summary>
@@ -83,13 +82,19 @@ public void Leave(string message, BreadcrumbType type, IDictionary<string, strin
8382
/// <param name="breadcrumb"></param>
8483
public void Leave(Breadcrumb breadcrumb)
8584
{
86-
if (breadcrumb != null)
85+
if (breadcrumb == null || _maximumBreadcrumbs < 1)
8786
{
88-
lock (_lock)
87+
return;
88+
}
89+
90+
lock (_lock)
91+
{
92+
if (_breadcrumbs.Count >= _maximumBreadcrumbs)
8993
{
90-
_breadcrumbs[_current] = breadcrumb;
91-
_current = (_current + 1) % _maximumBreadcrumbs;
94+
_breadcrumbs.RemoveFirst();
9295
}
96+
97+
_breadcrumbs.AddLast(breadcrumb);
9398
}
9499
}
95100

@@ -101,18 +106,7 @@ public IEnumerable<Breadcrumb> Retrieve()
101106
{
102107
lock (_lock)
103108
{
104-
var numberOfBreadcrumbs = System.Array.IndexOf(_breadcrumbs, null);
105-
106-
if (numberOfBreadcrumbs < 0) numberOfBreadcrumbs = _maximumBreadcrumbs;
107-
108-
var breadcrumbs = new Breadcrumb[numberOfBreadcrumbs];
109-
110-
for (int i = 0; i < numberOfBreadcrumbs; i++)
111-
{
112-
breadcrumbs[i] = _breadcrumbs[i];
113-
}
114-
115-
return breadcrumbs;
109+
return _breadcrumbs.ToList();
116110
}
117111
}
118112
}

src/Bugsnag/Client.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void Notify(System.Exception exception, HandledState handledState)
117117

118118
public void Notify(System.Exception exception, HandledState handledState, Middleware callback)
119119
{
120-
var report = new Report(_configuration, exception, handledState, Breadcrumbs.Retrieve().ToArray(), SessionTracking.CurrentSession);
120+
var report = new Report(_configuration, exception, handledState, Breadcrumbs.Retrieve(), SessionTracking.CurrentSession);
121121

122122
Notify(report, callback);
123123
}

src/Bugsnag/Payload/Report.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class Report : Dictionary<string, object>, IPayload
3535
/// <param name="severity"></param>
3636
/// <param name="breadcrumbs"></param>
3737
/// <param name="session"></param>
38-
public Report(IConfiguration configuration, System.Exception exception, HandledState severity, Breadcrumb[] breadcrumbs, Session session)
38+
public Report(IConfiguration configuration, System.Exception exception, HandledState severity, IEnumerable<Breadcrumb> breadcrumbs, Session session)
3939
{
4040
_ignored = false;
4141
Endpoint = configuration.Endpoint;

src/Directory.build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Project>
2+
3+
<Import Project="..\Directory.Build.props"/>
4+
25
<PropertyGroup>
36
<Authors>snmaynard kattrali martin308</Authors>
47
<Version></Version>

tests/Bugsnag.Tests/BreadcrumbsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public void CorrectBreadcrumbsAreReturned()
3636
{
3737
var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 5 });
3838

39-
for (int i = 0; i < 10; i++)
39+
for (int i = 0; i < 6; i++)
4040
{
4141
breadcrumbs.Leave($"{i}");
4242
}
4343

4444
var breadcrumbNames = breadcrumbs.Retrieve().Select(b => b.Name);
4545

46-
Assert.Equal(new string[] { "5", "6", "7", "8", "9" }, breadcrumbNames);
46+
Assert.Equal(new string[] { "1", "2", "3", "4", "5" }, breadcrumbNames);
4747
}
4848
}
4949
}

tests/Directory.build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
<PropertyGroup>
3+
<SignAssembly>false</SignAssembly>
4+
</PropertyGroup>
5+
</Project>

0 commit comments

Comments
 (0)