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

Chore/dependencies update #1

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ jobs:
PostgreSqlConnectionString: Server=localhost;Port=${{ job.services.postgres.ports[5432] }};Database=test;User Id=postgres;Password=postgres;
SQLServerConnectionString: Server=tcp:127.0.0.1,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=g0d4mm!tSQLServer;
- name: .NET Lib Pack
run: dotnet pack Build.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
run: dotnet pack Build.csproj --no-build -c Release /p:Packing=true /p:PackageOutputPath=$PWD/.nupkgs /p:CI=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.suo
*.user
*.sln.docstates
*.binlog
.vs/
.vscode/
**/Properties/launchSettings.json
Expand Down
2 changes: 1 addition & 1 deletion Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<ProjectReference Include="src\**\*.csproj" />
</ItemGroup>
<ItemGroup Condition="$(Packing) != 'true'">
<ItemGroup Condition="$(Packing) != 'true' and $(_IsPacking) != 'true'">
<ProjectReference Include="samples\**\*.csproj" Exclude="samples\**\*Mvc5*.csproj" />
<ProjectReference Include="tests\**\*.csproj" />
</ItemGroup>
Expand Down
12 changes: 9 additions & 3 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="xunit myget" value="https://www.myget.org/F/xunit/api/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<clear/>
<add key="xunit myget" value="https://www.myget.org/F/xunit/api/v3/index.json"/>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3"/>
</packageSources>
<packageSourceMapping>
<!-- key value for <packageSource> should match key values from <packageSources> element -->
<packageSource key="nuget.org">
<package pattern="*"/>
</packageSource>
</packageSourceMapping>
</configuration>
12 changes: 9 additions & 3 deletions StackExchange.Exceptional.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29519.161
# Visual Studio Version 17
VisualStudioVersion = 17.7.33711.374
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{9D33C076-4A0C-4366-89B8-9A735E6867EA}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -26,9 +26,14 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8B91532F-A112-4F73-80BD-A95B7359BBC3}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Packages.props = src\Directory.Packages.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{001E5AA4-42C8-4AC3-B14A-AF1DFA02E9FB}"
ProjectSection(SolutionItems) = preProject
samples\Directory.Build.props = samples\Directory.Build.props
samples\Directory.Packages.props = samples\Directory.Packages.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Exceptional.Shared", "src\StackExchange.Exceptional.Shared\StackExchange.Exceptional.Shared.csproj", "{D316FA70-8563-4360-A60F-1A43F3FA30E5}"
EndProject
Expand All @@ -46,6 +51,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{7D435EF2-8616-460D-82DB-EF4D74EEC459}"
ProjectSection(SolutionItems) = preProject
tests\Directory.Build.props = tests\Directory.Build.props
tests\Directory.Packages.props = tests\Directory.Packages.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Exceptional.Tests.AspNetCore", "tests\StackExchange.Exceptional.Tests.AspNetCore\StackExchange.Exceptional.Tests.AspNetCore.csproj", "{30BDD61C-A94B-4558-BB58-E9EEC0B8B845}"
Expand All @@ -56,7 +62,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Exceptional.P
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Exceptional.MongoDB", "src\StackExchange.Exceptional.MongoDB\StackExchange.Exceptional.MongoDB.csproj", "{8CFA59A5-5180-4466-A32E-507F3D541163}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.ConsoleNetCore", "samples\Samples.ConsoleNetCore\Samples.ConsoleNetCore.csproj", "{6CE269E1-6DC9-43A4-B6B8-683CE8A19E6A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.ConsoleNetCore", "samples\Samples.ConsoleNetCore\Samples.ConsoleNetCore.csproj", "{6CE269E1-6DC9-43A4-B6B8-683CE8A19E6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
21 changes: 11 additions & 10 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
image: Visual Studio 2022

init:
- git config --global core.autocrlf input
- SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%
- net start MSSQL$SQL2019

skip_branch_with_pr: true
skip_tags: true
skip_commits:
Expand All @@ -14,15 +9,15 @@ skip_commits:
environment:
Appveyor: true
# Postgres
POSTGRES_PATH: C:\Program Files\PostgreSQL\10
POSTGRES_PATH: C:\Program Files\PostgreSQL\16
PGUSER: postgres
PGPASSWORD: Password12!
POSTGRES_ENV_POSTGRES_USER: postgres
POSTGRES_ENV_POSTGRES_PASSWORD: Password12!
POSTGRES_ENV_POSTGRES_DB: test
PostgreSqlConnectionString: Server=localhost;Port=5432;Database=test;User Id=postgres;Password=Password12!;
# MySQL
MYSQL_PATH: C:\Program Files\MySql\MySQL Server 5.7
MYSQL_PATH: C:\Program Files\MySQL\MySQL Server 8.0
MYSQL_PWD: Password12!
MYSQL_ENV_MYSQL_USER: root
MYSQL_ENV_MYSQL_PASSWORD: Password12!
Expand All @@ -31,12 +26,18 @@ environment:
# MongoDB
MongoDBConnectionString: mongodb://localhost/test
# SQL Server
SQLServerConnectionString: Server=(local)\SQL2019;Database=master;User ID=sa;Password=Password12!
SQLServerConnectionString: Server=(local)\SQL2019;Database=master;User ID=sa;Password=Password12!;Encrypt=False

services:
- mysql
- postgresql10
- mongodb

init:
- git config --global core.autocrlf input
- SET PATH=%POSTGRES_PATH%\bin;%MYSQL_PATH%\bin;%PATH%
- net start MSSQL$SQL2019
- net start postgresql-x64-16
- ps: Start-Service MySQL80

nuget:
disable_publish_on_pr: true

Expand Down
5 changes: 3 additions & 2 deletions docs/Releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ layout: "default"
This page tracks major changes included in any update starting with version 2.0.0.

#### Unreleased
- Adds a `net6.0` build to main packages
- Bumps `Newtonsoft.Json` to version 13.0.1
- Moves to `net8.0` builds for main packages (dropping `netstandard2.0` and `netcoreapp*` support)
- Upgraded dependencies to avoid transitive CVE warnings for consumers
- Adds `Exceptional.Settings.CreatePathIfMissing` for auto-creating directories on startup (opt-in)
- Moved to `Microsoft.Data.SqlClient` for `net8.0` (still `System.Data.SqlClient` for `net462`) to simplify migrations

#### Version 2.2.17
- Bumps from `netcoreapp3.0` to `netcoreapp3.1` (since .NET Core 3.0 is no loner supported)
Expand Down
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"msbuild-sdks": {
"MSBuild.SDK.SystemWeb" : "4.0.93"
},
"sdk": {
"allowPrerelease": false
}
Expand Down
6 changes: 3 additions & 3 deletions samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>
<PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
15 changes: 15 additions & 0 deletions samples/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageVersion Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<PackageVersion Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="4.1.0" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.Net.Compilers.Toolset" Version="4.12.0-3.final" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Condition="'$(TargetFramework)'=='net8.0'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/Samples.AspNetCore/Samples.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions samples/Samples.Console/Samples.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\StackExchange.Exceptional\StackExchange.Exceptional.csproj" />
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
<PackageReference Include="System.Data.SQLite" Version="1.0.105.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\StackExchange.Exceptional.AspNetCore\StackExchange.Exceptional.AspNetCore.csproj" />
Expand Down
15 changes: 4 additions & 11 deletions samples/Samples.MVC5/Samples.MVC5.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="MSBuild.SDK.SystemWeb">
<PropertyGroup>
<AssemblyName>Samples.Mvc5</AssemblyName>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<OutputPath>bin\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\StackExchange.Exceptional\StackExchange.Exceptional.csproj" />
<ProjectReference Include="..\..\src\StackExchange.Exceptional.MySQL\StackExchange.Exceptional.MySQL.csproj" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageReference Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
<PackageReference Include="Microsoft.AspNet.Mvc" />
<PackageReference Include="Microsoft.AspNet.Web.Optimization" />
<PackageReference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Update="Global.asax.cs" DependentUpon="Global.asax" />
</ItemGroup>
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
22 changes: 20 additions & 2 deletions samples/Samples.MVC5/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,27 @@
<bindingRedirect oldVersion="0.0.0.0-3.4.1.9004" newVersion="3.4.1.9004" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701;612;618" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</compilers>
</system.codedom>
</configuration>
19 changes: 10 additions & 9 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>Latest</LangVersion>

<Authors>Nick Craver</Authors>
<Authors>Nick Craver</Authors>
<PackageId>$(AssemblyName)</PackageId>
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/NickCraver/StackExchange.Exceptional</PackageProjectUrl>
<PackageReleaseNotes>https://nickcraver.com/StackExchange.Exceptional/Releases</PackageReleaseNotes>
<Deterministic>false</Deterministic>


<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<DefaultLanguage>en-US</DefaultLanguage>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>

<PropertyGroup Condition="'$(CI)'=='true'">
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<DebugType>embedded</DebugType>
</PropertyGroup>

</Project>
23 changes: 23 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Dapper" Version="2.1.35" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="2.19.1" />
<PackageVersion Include="MySqlConnector" Version="2.2.6" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Npgsql" Version="8.0.6" />
<PackageVersion Include="System.Data.SqlClient" Version="4.8.6" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Condition="'$(TargetFramework)'!='net462'" Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.146" />
</ItemGroup>
</Project>
18 changes: 4 additions & 14 deletions src/StackExchange.Exceptional.AspNetCore/ExceptionalMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
Expand All @@ -23,11 +23,6 @@ public class ExceptionalMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger _logger;
#if NETSTANDARD2_0 || NET461
private readonly IHostingEnvironment _env;
#else
private readonly IWebHostEnvironment _env;
#endif
private readonly IOptions<ExceptionalSettings> _settings;

/// <summary>
Expand All @@ -40,22 +35,17 @@ public class ExceptionalMiddleware
public ExceptionalMiddleware(
RequestDelegate next,
IOptions<ExceptionalSettings> settings,
#if NETSTANDARD2_0 || NET461
IHostingEnvironment hostingEnvironment,
#else
IWebHostEnvironment hostingEnvironment,
#endif
IHostEnvironment hostingEnvironment,
ILoggerFactory loggerFactory)
{
_next = next;
_env = hostingEnvironment;
_logger = loggerFactory.CreateLogger<ExceptionalMiddleware>();
_settings = settings;

// If an ApplicationName isn't provided, default to IHostingEnvironment.ApplicationName
if (!_settings.Value.Store.ApplicationName.HasValue())
{
_settings.Value.Store.ApplicationName = _env.ApplicationName;
_settings.Value.Store.ApplicationName = hostingEnvironment.ApplicationName;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@
<RootNamespace>StackExchange.Exceptional</RootNamespace>
<Description>.NET Error handler/logger used internally at Stack Overflow. Primarily for logging all unhandled exceptions to SQL, but also supporting JSON and Memory based logging.</Description>
<PackageTags>SQL JSON Exception Handler Errors Stack Exchange Exceptional</PackageTags>
<TargetFrameworks>net461;netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="../StackExchange.Exceptional.Shared/StackExchange.Exceptional.Shared.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' OR '$(TargetFramework)' == 'net6.0'">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
</ItemGroup>
</Project>
Loading