Skip to content

Conversation

@logiclrd
Copy link
Contributor

@logiclrd logiclrd commented Oct 8, 2024

The BackblazeClient class has a few constructor overloads that take a bunch of parameters explicitly, including an ILoggerFactory. The default value for these is null. This was causing an exception deeper down because the base class Storage assumes it always has a valid ILoggerFactory. This PR fixes the issue by making Storage substitute NullLoggerFactory.Instance when it receives null.

…he supplied logger value to NullLoggerFactory.Instance, so that if a caller constructs an instance of BackblazeClient using the default logger value (which is null) then it still works.

Bumped the LangVersion in Backblaze.Client.csproj to 8.0 to support the null-coalescing operator.
….csproj with tests that passing null for the ILoggerFactory parameter does not cause a crash.

Added a reference to NSubstitute to Backblaze.Tests.Unit.csproj.
@logiclrd logiclrd force-pushed the JDG_FixBackblazeClientNonDefaultConstructors branch from dae2174 to 65d11ee Compare October 10, 2024 16:46
@logiclrd
Copy link
Contributor Author

Added regression tests. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant