Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET Core SDK 5.0.100 #266

Merged
merged 1 commit into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 66 additions & 57 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Version: 1.6.2 (Using https://semver.org/)
# Updated: 2020-11-02
# Version: 2.0.0 (Using https://semver.org/)
# Updated: 2020-11-15
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
# See http://EditorConfig.org for more information about .editorconfig files.
Expand Down Expand Up @@ -80,106 +80,115 @@ indent_style = tab
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions
##########################################

# Default Severity for .NET Code Style
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/configuration-options#scope
dotnet_analyzer_diagnostic.severity = warning

# .NET Code Style Settings
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
[*.{cs,csx,cake,vb,vbx}]
# "this." and "Me." qualifiers
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_event = true:warning
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_property = true
dotnet_style_qualification_for_method = true
dotnet_style_qualification_for_event = true
# Language keywords instead of framework type names for type references
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#language-keywords
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Modifier preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#normalize-modifiers
dotnet_style_require_accessibility_modifiers = always:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = always
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async
dotnet_style_readonly_field = true
# Parentheses preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parentheses-preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = always_for_clarity
# Expression-level preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
dotnet_style_object_initializer = true:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_object_initializer = true
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_inferred_anonymous_type_member_names = true
dotnet_style_prefer_auto_properties = true
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_diagnostic.IDE0045.severity = suggestion
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_diagnostic.IDE0046.severity = suggestion
dotnet_style_prefer_compound_assignment = true
# Null-checking preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#null-checking-preferences
dotnet_style_coalesce_expression = true:warning
dotnet_style_null_propagation = true:warning
dotnet_style_coalesce_expression = true
dotnet_style_null_propagation = true
# Parameter preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parameter-preferences
dotnet_code_quality_unused_parameters = all:warning
dotnet_code_quality_unused_parameters = all
# More style options (Undocumented)
# https://github.com/MicrosoftDocs/visualstudio-docs/issues/3641
dotnet_style_operator_placement_when_wrapping = end_of_line
# https://github.com/dotnet/roslyn/pull/40070
dotnet_style_prefer_simplified_interpolation = true:warning
dotnet_style_prefer_simplified_interpolation = true

# C# Code Style Settings
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
[*.{cs,csx,cake}]
# Implicit and explicit types
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:warning
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true
# Expression-bodied members
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
csharp_style_expression_bodied_methods = true:warning
csharp_style_expression_bodied_constructors = true:warning
csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:warning
csharp_style_expression_bodied_methods = true
csharp_style_expression_bodied_constructors = true
csharp_style_expression_bodied_operators = true
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_accessors = true
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = true
# Pattern matching
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#pattern-matching
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true
csharp_style_pattern_matching_over_as_with_null_check = true
# Inlined variable declarations
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#inlined-variable-declarations
csharp_style_inlined_variable_declaration = true:warning
csharp_style_inlined_variable_declaration = true
# Expression-level preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
csharp_prefer_simple_default_expression = true:warning
csharp_prefer_simple_default_expression = true
# "Null" checking preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-null-checking-preferences
csharp_style_throw_expression = true:warning
csharp_style_conditional_delegate_call = true:warning
csharp_style_throw_expression = true
csharp_style_conditional_delegate_call = true
# Code block preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#code-block-preferences
csharp_prefer_braces = true:warning
csharp_prefer_braces = true
# Unused value preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#unused-value-preferences
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable
dotnet_diagnostic.IDE0058.severity = suggestion
csharp_style_unused_value_assignment_preference = discard_variable
dotnet_diagnostic.IDE0059.severity = suggestion
# Index and range preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_index_operator = true
csharp_style_prefer_range_operator = true
# Miscellaneous preferences
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
csharp_style_deconstructed_variable_declaration = true:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_using_directive_placement = inside_namespace:warning
csharp_prefer_static_local_function = true:warning
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_deconstructed_variable_declaration = true
csharp_style_pattern_local_over_anonymous_function = true
csharp_using_directive_placement = inside_namespace
csharp_prefer_static_local_function = true
csharp_prefer_simple_using_statement = true
dotnet_diagnostic.IDE0063.severity = suggestion

##########################################
# .NET Formatting Conventions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void AddProperty(string key, object value)
$"Cannot add exception property '{key}' to bag, after results were already collected");
}

if (this.filter is object)
if (this.filter is not null)
{
if (this.filter.ShouldPropertyBeFiltered(this.exception, key, value))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup Label="Build">
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1;net461</TargetFrameworks>
<TargetFrameworks>net5.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand All @@ -15,14 +15,14 @@
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0" />
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
<PackageReference Include="System.Security.Principal.Windows" Version="4.7.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
</ItemGroup>

<ItemGroup Label="Package References (.NET Core)" Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<ItemGroup Label="Package References (.NET)" Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
</ItemGroup>

<ItemGroup Label="References (.NET Framework)" Condition=" '$(TargetFramework)' == 'net461' ">
<ItemGroup Label="References (.NET Framework)" Condition=" '$(TargetFramework)' == 'net472' ">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup Label="Build">
<LangVersion>latest</LangVersion>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<AnalysisLevel>latest</AnalysisLevel>
<NeutralLanguage>en-GB</NeutralLanguage>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -21,7 +22,6 @@
</PropertyGroup>

<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" PrivateAssets="All" Version="3.3.1" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="All" Version="16.8.55" />
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand All @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net5.0;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand All @@ -10,13 +10,12 @@
<PackageTags>Serilog;Exception;Log;Logging;Detail;Details;SQL;Server</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.0" />
</ItemGroup>


<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Source\Serilog.Exceptions\Serilog.Exceptions.csproj" />
</ItemGroup>

<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>netstandard2.0;netstandard1.6;netstandard1.3;net461;net472</TargetFrameworks>
<TargetFrameworks>net5.0;netstandard2.0;netstandard1.6;netstandard1.3;net472;net461</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
Expand All @@ -10,12 +10,11 @@
<PackageTags>Serilog;Exception;Log;Logging;Detail;Details;SQL;Server</PackageTags>
</PropertyGroup>


<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Source\Serilog.Exceptions\Serilog.Exceptions.csproj" />
</ItemGroup>

<ItemGroup Label="Package References (.NET Standard)" Condition=" '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard1.3' ">
<ItemGroup Label="Package References (.NET)" Condition="'$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'netstandard1.6' OR '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public DestructuringOptionsBuilder WithDefaultDestructurers() =>
/// <returns>Options builder for method chaining.</returns>
public DestructuringOptionsBuilder WithFilter(IExceptionPropertyFilter filter)
{
if (this.Filter is object)
if (this.Filter is not null)
{
throw new InvalidOperationException(
string.Format(CultureInfo.InvariantCulture, Resources.FilterAlreadySet, nameof(CompositeExceptionPropertyFilter)));
Expand Down
4 changes: 2 additions & 2 deletions Source/Serilog.Exceptions/Core/ExceptionEnricher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory)
throw new ArgumentNullException(nameof(propertyFactory));
}

if (logEvent.Exception is object)
if (logEvent.Exception is not null)
{
var dataDictionary = this.DestructureException(logEvent.Exception);

if (dataDictionary is object)
if (dataDictionary is not null)
{
logEvent.AddPropertyIfAbsent(propertyFactory.CreateProperty(
this.destructuringOptions.RootName,
Expand Down
2 changes: 1 addition & 1 deletion Source/Serilog.Exceptions/Core/ExceptionPropertiesBag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void AddProperty(string key, object value)
throw new InvalidOperationException($"Cannot add exception property '{key}' to bag, after results were already collected");
}

if (this.filter is object)
if (this.filter is not null)
{
if (this.filter.ShouldPropertyBeFiltered(this.exception, key, value))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public virtual Type[] TargetTypes
foreach (var dangerousType in GetNotHandledByMonoTypes())
{
var type = Type.GetType(dangerousType);
if (type is object)
if (type is not null)
{
targetTypes.Add(type);
}
Expand Down Expand Up @@ -253,13 +253,13 @@ internal static void DestructureCommonExceptionProperties(
propertiesBag.AddProperty(nameof(Exception.StackTrace), exception.StackTrace);

#if NET461 || NET472
if (exception.TargetSite is object)
if (exception.TargetSite is not null)
{
propertiesBag.AddProperty(nameof(Exception.TargetSite), exception.TargetSite.ToString());
}
#endif

if (exception.InnerException is object)
if (exception.InnerException is not null)
{
propertiesBag.AddProperty(nameof(Exception.InnerException), innerDestructure(exception.InnerException));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void AppendProperties(
catch (TargetInvocationException targetInvocationException)
{
var innerException = targetInvocationException.InnerException;
if (innerException is object)
if (innerException is not null)
{
addPropertyAction(property.Name, $"threw {innerException.GetType().FullName}: {innerException.Message}");
}
Expand Down Expand Up @@ -361,7 +361,7 @@ private IDictionary<string, object> DestructureObject(
catch (TargetInvocationException targetInvocationException)
{
var innerException = targetInvocationException.InnerException;
if (innerException is object)
if (innerException is not null)
{
values.Add(property.Name, $"threw {innerException.GetType().FullName}: {innerException.Message}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override void Destructure(

#pragma warning disable CA1062 // Validate arguments of public methods
var reflectionTypeLoadException = (ReflectionTypeLoadException)exception;
if (reflectionTypeLoadException.LoaderExceptions is object)
if (reflectionTypeLoadException.LoaderExceptions is not null)
{
propertiesBag.AddProperty(
nameof(ReflectionTypeLoadException.LoaderExceptions),
Expand Down
Loading