diff --git a/.editorconfig b/.editorconfig index 2e66ff9..5d34a42 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,16 @@ # top-most EditorConfig file for Macross Software root = true +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + [*.{cs,js,config,xml,json,html,htm,aspx,asmx,ascx,css,token,xaml,sql,cshtml,ps1}] indent_style = tab tab_width = 4 -trim_trailing_whitespace = true indent_size = tab # Dotnet code style settings: @@ -183,4 +189,4 @@ dotnet_diagnostic.IDE0005.severity = warning dotnet_diagnostic.CA1303.severity = none [*.cshtml.cs] -dotnet_diagnostic.SA1649.severity = none \ No newline at end of file +dotnet_diagnostic.SA1649.severity = none diff --git a/.github/workflows/Component.BuildTest.yml b/.github/workflows/Component.BuildTest.yml new file mode 100644 index 0000000..4c140cb --- /dev/null +++ b/.github/workflows/Component.BuildTest.yml @@ -0,0 +1,78 @@ +# Called by ci.yml to build & test project files +# See: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow +name: Build Component + +on: + workflow_call: + inputs: + project-name: + required: true + type: string + project-build-commands: + default: '' + required: false + type: string + code-cov-name: + required: true + type: string + code-cov-prefix: + default: 'unittests' + required: false + type: string + os-list: + default: '[ "windows-latest", "ubuntu-latest" ]' + required: false + type: string + tfm-list: + default: '[ "net462", "net6.0", "net6.0-windows" ]' + required: false + type: string + +jobs: + build-test: + + strategy: + fail-fast: false # ensures the entire test matrix is run, even if one permutation fails + matrix: + os: ${{ fromJSON(inputs.os-list) }} + version: ${{ fromJSON(inputs.tfm-list) }} + exclude: + - os: ubuntu-latest + version: net462 + - os: ubuntu-latest + version: net6.0-windows + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + + - name: dotnet restore ${{ inputs.project-name }} + run: dotnet restore ${{ inputs.project-name }} ${{ inputs.project-build-commands }} + + - name: dotnet build ${{ inputs.project-name }} + run: dotnet build ${{ inputs.project-name }} --configuration Release --no-restore ${{ inputs.project-build-commands }} + + - name: dotnet test ${{ inputs.project-name }} + run: dotnet test ${{ inputs.project-name }} --collect:"Code Coverage" --results-directory:TestResults --framework ${{ matrix.version }} --configuration Release --no-restore --no-build --logger:"console;verbosity=detailed" -- RunConfiguration.DisableAppDomain=true + + - name: Install coverage tool + run: dotnet tool install -g dotnet-coverage + + - name: Merging test results + run: dotnet-coverage merge -r -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/*.coverage + + - name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} + uses: codecov/codecov-action@v3.1.4 + continue-on-error: true # Note: Don't fail for upload failures + if: ${{ false }} # Note: Disabled for now + env: + OS: ${{ matrix.os }} + TFM: ${{ matrix.version }} + with: + file: TestResults/Cobertura.xml + env_vars: OS,TFM + flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} + name: Code Coverage for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6042764 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,55 @@ +name: Build + +on: + pull_request: + branches: [ 'develop*', 'master*' ] + +jobs: + lint-misspell-sanitycheck: + uses: ./.github/workflows/sanitycheck.yml + + detect-changes: + runs-on: windows-latest + outputs: + changes: ${{ steps.changes.outputs.changes }} + steps: + - uses: AurorNZ/paths-filter@v3 + id: changes + with: + filters: | + md: ['**.md'] + build: ['build/**', '.github/**/*.yml', '**/*.targets', '**/*.props'] + code: ['**.cs', '**.csproj', '.editorconfig'] + + lint-md: + needs: detect-changes + if: contains(needs.detect-changes.outputs.changes, 'md') + uses: ./.github/workflows/markdownlint.yml + + lint-dotnet-format: + needs: detect-changes + if: contains(needs.detect-changes.outputs.changes, 'code') + uses: ./.github/workflows/dotnet-format.yml + + build-test-solution: + needs: detect-changes + if: | + contains(needs.detect-changes.outputs.changes, 'code') + || contains(needs.detect-changes.outputs.changes, 'build') + uses: ./.github/workflows/Component.BuildTest.yml + with: + project-name: 'Macross-Master.sln' + code-cov-name: 'Solution' + + build-test: + needs: [ + lint-misspell-sanitycheck, + detect-changes, + lint-md, + lint-dotnet-format, + build-test-solution, + ] + if: always() && !cancelled() && !contains(needs.*.result, 'failure') + runs-on: windows-latest + steps: + - run: echo 'build complete' diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml new file mode 100644 index 0000000..ce400aa --- /dev/null +++ b/.github/workflows/dotnet-format.yml @@ -0,0 +1,23 @@ +# Called by ci.yml to perform dotnet format linting +# See: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow +name: Lint - dotnet format + +on: + workflow_call: + +jobs: + run-dotnet-format: + runs-on: windows-latest + + steps: + - name: check out code + uses: actions/checkout@v4 + + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + + - name: dotnet restore + run: dotnet restore + + - name: dotnet format + run: dotnet format Macross-Master.sln --no-restore --verify-no-changes diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml new file mode 100644 index 0000000..c1061ac --- /dev/null +++ b/.github/workflows/markdownlint.yml @@ -0,0 +1,20 @@ +# Called by ci.yml to perform markdown linting +# See: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow +name: Lint - Markdown + +on: + workflow_call: + +jobs: + run-markdownlint: + runs-on: ubuntu-latest + + steps: + - name: check out code + uses: actions/checkout@v4 + + - name: install markdownlint-cli + run: sudo npm install -g markdownlint-cli + + - name: run markdownlint + run: markdownlint . diff --git a/.github/workflows/sanitycheck.yml b/.github/workflows/sanitycheck.yml new file mode 100644 index 0000000..5879a35 --- /dev/null +++ b/.github/workflows/sanitycheck.yml @@ -0,0 +1,32 @@ +# Called by ci.yml to perform general linting +# See: https://docs.github.com/en/actions/using-workflows/reusing-workflows#creating-a-reusable-workflow +name: Lint - Spelling & Encoding + +on: + workflow_call: + +jobs: + run-misspell: + runs-on: ubuntu-latest + + steps: + - name: check out code + uses: actions/checkout@v4 + + - name: install misspell + run: | + curl -L -o ./install-misspell.sh https://git.io/misspell + sh ./install-misspell.sh + + - name: run misspell + run: ./bin/misspell -error . + + run-sanitycheck: + runs-on: ubuntu-latest + + steps: + - name: check out code + uses: actions/checkout@v4 + + - name: detect non-ASCII encoding and trailing space + run: python3 ./sanitycheck.py diff --git a/Build/Gated Build Pipeline.yml b/Build/Gated Build Pipeline.yml deleted file mode 100644 index 9fe703e..0000000 --- a/Build/Gated Build Pipeline.yml +++ /dev/null @@ -1,55 +0,0 @@ -trigger: -- master -- develop - -variables: - solution: 'Macross-Master.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -jobs: -- job: Macross_Master_Gated_Win - displayName: Macross Master Solution Gated Build - Windows - pool: - vmImage: 'windows-latest' - steps: - - task: UseDotNet@2 - inputs: - useGlobalJson: true - - - task: UseDotNet@2 - inputs: - version: '5.0.x' - - - task: UseDotNet@2 - inputs: - version: '3.1.x' - - - task: UseDotNet@2 - inputs: - version: '2.1.x' - - - task: NuGetToolInstaller@1 - inputs: - versionSpec: 5.8 - - - task: DotNetCoreCLI@2 - displayName: Dotnet Restore - inputs: - command: 'restore' - projects: '$(solution)' - arguments: '--configuration $(buildConfiguration)' - - - task: DotNetCoreCLI@2 - displayName: Dotnet Build - inputs: - command: 'build' - projects: '$(solution)' - arguments: '--configuration $(buildConfiguration) --no-restore' - - - task: DotNetCoreCLI@2 - displayName: Dotnet Test - inputs: - command: 'test' - projects: '$(solution)' - arguments: '--configuration $(buildConfiguration) --no-build --filter TestCategory!=Integration' \ No newline at end of file diff --git a/ClassLibraries/Macross.CommandLine/Code/CommandLineArguments.cs b/ClassLibraries/Macross.CommandLine/Code/CommandLineArguments.cs index 0b9c522..252e299 100644 --- a/ClassLibraries/Macross.CommandLine/Code/CommandLineArguments.cs +++ b/ClassLibraries/Macross.CommandLine/Code/CommandLineArguments.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +#if !NETSTANDARD2_0 using System.Diagnostics.CodeAnalysis; +#endif namespace Macross.CommandLine { diff --git a/ClassLibraries/Macross.CommandLine/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.CommandLine/Code/Properties/AssemblyInfo.cs index f601ee0..91e95e0 100644 --- a/ClassLibraries/Macross.CommandLine/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.CommandLine/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("c41cb00f-9086-4e76-936f-da915f971e51")] -[assembly: AssemblyVersion("0.0.1.20011")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1.20011")] diff --git a/ClassLibraries/Macross.CommandLine/README.md b/ClassLibraries/Macross.CommandLine/README.md index 259c632..ca626c5 100644 --- a/ClassLibraries/Macross.CommandLine/README.md +++ b/ClassLibraries/Macross.CommandLine/README.md @@ -1,9 +1,13 @@ # Macross Software Command-Line -Macross.CommandLine is a simple and light-weight .NET Standard 2.0+ library for parsing the `string[]` command-line arguments passed into a process into a command with optional parameters, options, and switches. +Macross.CommandLine is a simple and light-weight .NET Standard 2.0+ library for +parsing the `string[]` command-line arguments passed into a process into a +command with optional parameters, options, and switches. ## Format -The parser supports the general format used by the `dotnet` command-line interface: +The parser supports the general format used by the `dotnet` command-line +interface: -`C:\application.exe command parameter1 parameter2 -option1 option1value -option2=option2value --option3 option3value -switch1` \ No newline at end of file +`C:\application.exe command parameter1 parameter2 -option1 option1value +-option2=option2value --option3 option3value -switch1` diff --git a/ClassLibraries/Macross.CommandLine/Test/CommandLineTests.cs b/ClassLibraries/Macross.CommandLine/Test/CommandLineTests.cs index fc36e8e..d1136ce 100644 --- a/ClassLibraries/Macross.CommandLine/Test/CommandLineTests.cs +++ b/ClassLibraries/Macross.CommandLine/Test/CommandLineTests.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/ClassLibraries/Macross.CommandLine/Test/Macross.CommandLine.Tests.csproj b/ClassLibraries/Macross.CommandLine/Test/Macross.CommandLine.Tests.csproj index 2f1a92b..662e3af 100644 --- a/ClassLibraries/Macross.CommandLine/Test/Macross.CommandLine.Tests.csproj +++ b/ClassLibraries/Macross.CommandLine/Test/Macross.CommandLine.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software command-line library tests. diff --git a/ClassLibraries/Macross.Extensions/Code/Extensions/System/ConversionExtensions.cs b/ClassLibraries/Macross.Extensions/Code/Extensions/System/ConversionExtensions.cs index 50eb1fe..6d9a0f3 100644 --- a/ClassLibraries/Macross.Extensions/Code/Extensions/System/ConversionExtensions.cs +++ b/ClassLibraries/Macross.Extensions/Code/Extensions/System/ConversionExtensions.cs @@ -65,34 +65,34 @@ public static string ToString(this byte[] data, int offset, int count, Encoding } /// - /// Converts an array of bytes into a string of hexidecimal characters. + /// Converts an array of bytes into a string of hexadecimal characters. /// - /// Sequence of bytes to be converted into a hexidecimal string instance. - /// Hexidecimal string instance of the converted bytes. + /// Sequence of bytes to be converted into a hexadecimal string instance. + /// Hexadecimal string instance of the converted bytes. public static string ToHexString(this byte[] data) => new string(ToHexArray(data, 0, data?.Length ?? 0)); /// - /// Converts an array of bytes into an array of hexidecimal characters. + /// Converts an array of bytes into an array of hexadecimal characters. /// - /// Sequence of bytes to be converted into a hexidecimal character array instance. - /// Array of hexidecimal characters converted from the provided bytes. + /// Sequence of bytes to be converted into a hexadecimal character array instance. + /// Array of hexadecimal characters converted from the provided bytes. public static char[] ToHexArray(this byte[] data) => ToHexArray(data, 0, data?.Length ?? 0); /// - /// Converts an array of bytes into a string of hexidecimal characters. + /// Converts an array of bytes into a string of hexadecimal characters. /// - /// Sequence of bytes to be converted into a hexidecimal string instance. - /// Hexidecimal string instance of the converted bytes. + /// Sequence of bytes to be converted into a hexadecimal string instance. + /// Hexadecimal string instance of the converted bytes. public static string ToHexString(this ArraySegment data) => new string(ToHexArray(data)); /// - /// Converts an array of bytes into an array of hexidecimal characters. + /// Converts an array of bytes into an array of hexadecimal characters. /// - /// Sequence of bytes to be converted into a hexidecimal character array instance. - /// Array of hexidecimal characters converted from the provided bytes. + /// Sequence of bytes to be converted into a hexadecimal character array instance. + /// Array of hexadecimal characters converted from the provided bytes. public static char[] ToHexArray(this ArraySegment data) => ToHexArray(data.Array, data.Offset, data.Count); @@ -113,10 +113,10 @@ private static char[] ToHexArray(byte[] data, int offset, int count) } /// - /// Converts a byte into a string of hexidecimal characters. + /// Converts a byte into a string of hexadecimal characters. /// - /// Byte value to be converted into a hexidecimal string instance. - /// Hexidecimal string instance of the converted bytes. + /// Byte value to be converted into a hexadecimal string instance. + /// Hexadecimal string instance of the converted bytes. public static string ToHexString(this byte value) { return new string(new char[2] diff --git a/ClassLibraries/Macross.Extensions/Code/Extensions/System/System.Collections.Generic/ConversionExtensions.cs b/ClassLibraries/Macross.Extensions/Code/Extensions/System/System.Collections.Generic/ConversionExtensions.cs index e4aadc9..d02262d 100644 --- a/ClassLibraries/Macross.Extensions/Code/Extensions/System/System.Collections.Generic/ConversionExtensions.cs +++ b/ClassLibraries/Macross.Extensions/Code/Extensions/System/System.Collections.Generic/ConversionExtensions.cs @@ -8,24 +8,24 @@ namespace System.Collections.Generic public static class ConversionExtensions { /// - /// Converts a hexidecimal string into a corresponding sequence of bytes. + /// Converts a hexadecimal string into a corresponding sequence of bytes. /// - /// Hexidecimal characters to be converted into bytes. + /// Hexadecimal characters to be converted into bytes. /// Converted array of bytes. - public static byte[] ToByteArray(this IEnumerable hexidecimalCharacters) => ToByteArray(hexidecimalCharacters, 0, hexidecimalCharacters?.Count() ?? 0); + public static byte[] ToByteArray(this IEnumerable hexadecimalCharacters) => ToByteArray(hexadecimalCharacters, 0, hexadecimalCharacters?.Count() ?? 0); /// - /// Converts a hexidecimal string into a corresponding sequence of bytes. + /// Converts a hexadecimal string into a corresponding sequence of bytes. /// - /// Hexidecimal characters to be converted into bytes. + /// Hexadecimal characters to be converted into bytes. /// The index into the characters at which to begin conversion. /// The number of characters to convert from the offset. /// Converted array of bytes. - public static byte[] ToByteArray(this IEnumerable hexidecimalCharacters, int offset, int count) + public static byte[] ToByteArray(this IEnumerable hexadecimalCharacters, int offset, int count) { - if (hexidecimalCharacters == null) - throw new ArgumentNullException(nameof(hexidecimalCharacters)); - if (offset + count > hexidecimalCharacters.Count()) + if (hexadecimalCharacters == null) + throw new ArgumentNullException(nameof(hexadecimalCharacters)); + if (offset + count > hexadecimalCharacters.Count()) throw new ArgumentException("Offset and Count should refer to a range within the data."); if (count % 2 == 1) throw new InvalidOperationException("Hex data cannot have an odd number of digits."); @@ -35,7 +35,7 @@ public static byte[] ToByteArray(this IEnumerable hexidecimalCharacters, i int i = 0; int LastCharValue = -1; - WriteHexCharsToArray(hexidecimalCharacters, offset, count, Data, ref i, ref LastCharValue); + WriteHexCharsToArray(hexadecimalCharacters, offset, count, Data, ref i, ref LastCharValue); return Data; } diff --git a/ClassLibraries/Macross.Extensions/README.md b/ClassLibraries/Macross.Extensions/README.md index a640838..69b4be3 100644 --- a/ClassLibraries/Macross.Extensions/README.md +++ b/ClassLibraries/Macross.Extensions/README.md @@ -1,3 +1,4 @@ # Macross Software Extensons -Macross.Extensions is .NET Standard 2.0+ library for augmenting what is provided out of the box by the framework. \ No newline at end of file +Macross.Extensions is .NET Standard 2.0+ library for augmenting what is provided +out of the box by the framework. diff --git a/ClassLibraries/Macross.Extensions/Test/Macross.Extensions.Tests.csproj b/ClassLibraries/Macross.Extensions/Test/Macross.Extensions.Tests.csproj index 972c7ff..ad29093 100644 --- a/ClassLibraries/Macross.Extensions/Test/Macross.Extensions.Tests.csproj +++ b/ClassLibraries/Macross.Extensions/Test/Macross.Extensions.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software extensions library tests. diff --git a/ClassLibraries/Macross.Json.Extensions/CHANGELOG.md b/ClassLibraries/Macross.Json.Extensions/CHANGELOG.md index 1c2f6a8..15c55f0 100644 --- a/ClassLibraries/Macross.Json.Extensions/CHANGELOG.md +++ b/ClassLibraries/Macross.Json.Extensions/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog ## 3.0.0 @@ -116,4 +116,4 @@ ``` * Exceptions thrown during deserialization now include JSON path information as - part of the exception message. \ No newline at end of file + part of the exception message. diff --git a/ClassLibraries/Macross.Json.Extensions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Json.Extensions/Code/Properties/AssemblyInfo.cs index 75982d3..081dfdf 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,4 +10,4 @@ [assembly: InternalsVisibleTo("Macross.Json.Extensions.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010051b7a480b13cecfa44862449486c6884bd6168c325445a0848f48deca9643657c5ae85df3cf6ffdb24d5bd3e9b71dc074ca602544b83511fbce1f83f1d06bb8b7b564414c9d8c719e4e39b95643dfc8e9ce997b5e2a1542a8ff6379186f87b8b695fee82c506170c4fb8ffcbf2e68f4b5d270083f8909c67916500608ce747e9")] -[assembly: AssemblyVersion("3.0.0.22164")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.0.22164")] diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent.cs index 76b3f2e..c84f682 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; namespace System.Net.Http @@ -33,4 +33,4 @@ protected override bool TryComputeLength(out long length) return false; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent{T}.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent{T}.cs index 167429c..ba90ef2 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent{T}.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Net.Http/PushStreamContent{T}.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Threading.Tasks; namespace System.Net.Http @@ -37,4 +37,4 @@ protected override bool TryComputeLength(out long length) return false; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeConverter.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeConverter.cs index 31bf709..022b657 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeConverter.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeConverter.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Buffers.Text; using System.Reflection; using System.Reflection.Emit; @@ -124,4 +124,4 @@ public override void Write(Utf8JsonWriter writer, DateTime value, JsonSerializer } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeOffsetConverter.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeOffsetConverter.cs index 6d5b7d3..3ddadc7 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeOffsetConverter.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonMicrosoftDateTimeOffsetConverter.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Buffers.Text; using Macross.Json.Extensions; @@ -124,4 +124,4 @@ public override void Write(Utf8JsonWriter writer, DateTimeOffset value, JsonSeri => JsonMicrosoftDateTimeOffsetConverter.Write(writer, in value); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonTypeConverterAdapter.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonTypeConverterAdapter.cs index 993aa7e..d794563 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonTypeConverterAdapter.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json.Serialization/JsonTypeConverterAdapter.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using System.Linq; using System.Reflection; @@ -51,4 +51,4 @@ public override void Write(Utf8JsonWriter writer, T objectToWrite, JsonSerialize => writer.WriteStringValue(_Converter.ConvertToString(objectToWrite)); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json/Utf8JsonStreamReader.cs b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json/Utf8JsonStreamReader.cs index 64f617b..f3ac78f 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json/Utf8JsonStreamReader.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/System.Text.Json/Utf8JsonStreamReader.cs @@ -1,4 +1,4 @@ -using System.Buffers; +using System.Buffers; using System.Diagnostics; using System.IO; using System.Threading; @@ -18,7 +18,7 @@ public static class Utf8JsonStreamReader => ArrayPool.Shared.Return(buffer); /// - /// Utf8JsonStreamReader deserialization state maching callback. + /// Utf8JsonStreamReader deserialization state machine callback. /// /// The type being deserialized. /// The instance of being deserialized. @@ -280,4 +280,4 @@ public void Dispose() } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/Code/ThrowHelper.cs b/ClassLibraries/Macross.Json.Extensions/Code/ThrowHelper.cs index 845be25..3095a08 100644 --- a/ClassLibraries/Macross.Json.Extensions/Code/ThrowHelper.cs +++ b/ClassLibraries/Macross.Json.Extensions/Code/ThrowHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Reflection; using System.Text.Json; @@ -62,4 +62,4 @@ public static JsonException GenerateJsonException_DeserializeUnableToConvertValu return jsonException; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Json.Extensions/README.md b/ClassLibraries/Macross.Json.Extensions/README.md index 9ceb597..ff39eeb 100644 --- a/ClassLibraries/Macross.Json.Extensions/README.md +++ b/ClassLibraries/Macross.Json.Extensions/README.md @@ -444,4 +444,4 @@ public class MyCustomTypeConverter : TypeConverter return base.ConvertTo(context, culture, value, destinationType); } } -``` \ No newline at end of file +``` diff --git a/ClassLibraries/Macross.Json.Extensions/Test/JsonIPAddressConverterTests.cs b/ClassLibraries/Macross.Json.Extensions/Test/JsonIPAddressConverterTests.cs index b17ed00..58ecbe7 100644 --- a/ClassLibraries/Macross.Json.Extensions/Test/JsonIPAddressConverterTests.cs +++ b/ClassLibraries/Macross.Json.Extensions/Test/JsonIPAddressConverterTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Net; +using System.Net; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/ClassLibraries/Macross.Json.Extensions/Test/JsonIPEndPointConverterTests.cs b/ClassLibraries/Macross.Json.Extensions/Test/JsonIPEndPointConverterTests.cs index 572f92e..88fd851 100644 --- a/ClassLibraries/Macross.Json.Extensions/Test/JsonIPEndPointConverterTests.cs +++ b/ClassLibraries/Macross.Json.Extensions/Test/JsonIPEndPointConverterTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Net; +using System.Net; using System.Text.Json; using System.Text.Json.Serialization; diff --git a/ClassLibraries/Macross.Json.Extensions/Test/Macross.Json.Extensions.Tests.csproj b/ClassLibraries/Macross.Json.Extensions/Test/Macross.Json.Extensions.Tests.csproj index 3091dd2..27f36d1 100644 --- a/ClassLibraries/Macross.Json.Extensions/Test/Macross.Json.Extensions.Tests.csproj +++ b/ClassLibraries/Macross.Json.Extensions/Test/Macross.Json.Extensions.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net6.0;net462 + net6.0;net462 true keypair.snk Macross Software System.Text.Json extensions library tests. diff --git a/ClassLibraries/Macross.Json.Extensions/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Json.Extensions/Test/Properties/AssemblyInfo.cs index 58bba3f..0d959df 100644 --- a/ClassLibraries/Macross.Json.Extensions/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Json.Extensions/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("c365f59c-0a68-463e-91f0-9d026b568f01")] -[assembly: AssemblyVersion("0.0.0.22159")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.22159")] diff --git a/ClassLibraries/Macross.Logging.Abstractions/CHANGELOG.md b/ClassLibraries/Macross.Logging.Abstractions/CHANGELOG.md index 3ce6ae9..3fddd06 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/CHANGELOG.md +++ b/ClassLibraries/Macross.Logging.Abstractions/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog ## 2.0.0 @@ -35,4 +35,4 @@ extensions) to eliminate boxing. * Updated `LogValuesFormatter` to the latest version from `dotnet\runtime` to - reduce allocations on startup. \ No newline at end of file + reduce allocations on startup. diff --git a/ClassLibraries/Macross.Logging.Abstractions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.Abstractions/Code/Properties/AssemblyInfo.cs index 3efc817..cceeca9 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.Abstractions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("d24d02b2-8e78-4224-93da-1dd2ff88d915")] -[assembly: AssemblyVersion("2.0.0.21013")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.0.21013")] diff --git a/ClassLibraries/Macross.Logging.Abstractions/Code/ValueStringBuilder.cs b/ClassLibraries/Macross.Logging.Abstractions/Code/ValueStringBuilder.cs index 8ee34a2..cd661dd 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/Code/ValueStringBuilder.cs +++ b/ClassLibraries/Macross.Logging.Abstractions/Code/ValueStringBuilder.cs @@ -1,4 +1,4 @@ -// From: https://github.com/dotnet/runtime/blob/1d9e50cb4735df46d3de0cee5791e97295eaf588/src/libraries/Common/src/System/Text/ValueStringBuilder.cs +// From: https://github.com/dotnet/runtime/blob/1d9e50cb4735df46d3de0cee5791e97295eaf588/src/libraries/Common/src/System/Text/ValueStringBuilder.cs // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // @@ -312,4 +312,4 @@ public void Dispose() } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.Abstractions/README.md b/ClassLibraries/Macross.Logging.Abstractions/README.md index a5a5bc2..11f5220 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/README.md +++ b/ClassLibraries/Macross.Logging.Abstractions/README.md @@ -266,4 +266,4 @@ and [Macross.Windows.Debugging](../Macross.Windows.Debugging/README.md). Other log frameworks will be a mixed bag. Frameworks that just "ToString()" the formatter will ignore the extra data. Formatters that loop over all the properties on `state` should pick up the data as `{Data}` property and write it -into their logs as they would any other `state` property. \ No newline at end of file +into their logs as they would any other `state` property. diff --git a/ClassLibraries/Macross.Logging.Abstractions/Test/LoggerJsonMessageTests.cs b/ClassLibraries/Macross.Logging.Abstractions/Test/LoggerJsonMessageTests.cs index 116c9ad..72f2d33 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/Test/LoggerJsonMessageTests.cs +++ b/ClassLibraries/Macross.Logging.Abstractions/Test/LoggerJsonMessageTests.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text.Json; +using System.Text.Json.Serialization; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -202,7 +203,7 @@ public void SerializeMessageToJsonTest() Logger.Message, new JsonSerializerOptions { - IgnoreNullValues = true + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }); Assert.IsNotNull(Logger.Message); diff --git a/ClassLibraries/Macross.Logging.Abstractions/Test/Macross.Logging.Abstractions.Tests.csproj b/ClassLibraries/Macross.Logging.Abstractions/Test/Macross.Logging.Abstractions.Tests.csproj index f04fd3f..de92cd7 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/Test/Macross.Logging.Abstractions.Tests.csproj +++ b/ClassLibraries/Macross.Logging.Abstractions/Test/Macross.Logging.Abstractions.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software logging abstractions library tests. diff --git a/ClassLibraries/Macross.Logging.Abstractions/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.Abstractions/Test/Properties/AssemblyInfo.cs index 25d8707..a426f21 100644 --- a/ClassLibraries/Macross.Logging.Abstractions/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.Abstractions/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("cd0b863d-924e-48e6-9b2d-17859cd0ca40")] -[assembly: AssemblyVersion("0.0.0.21013")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.21013")] diff --git a/ClassLibraries/Macross.Logging.Files/Benchmarks/Macross.Logging.Files.Benchmarks.csproj b/ClassLibraries/Macross.Logging.Files/Benchmarks/Macross.Logging.Files.Benchmarks.csproj index 2db1b5b..ac8b453 100644 --- a/ClassLibraries/Macross.Logging.Files/Benchmarks/Macross.Logging.Files.Benchmarks.csproj +++ b/ClassLibraries/Macross.Logging.Files/Benchmarks/Macross.Logging.Files.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net5.0;netcoreapp3.1 + net6.0 true false false diff --git a/ClassLibraries/Macross.Logging.Files/Benchmarks/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.Files/Benchmarks/Properties/AssemblyInfo.cs index 5796d00..c9b5e08 100644 --- a/ClassLibraries/Macross.Logging.Files/Benchmarks/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.Files/Benchmarks/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("8717717d-8f61-4559-8095-629b34a11692")] -[assembly: AssemblyVersion("0.0.0.20167")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20167")] diff --git a/ClassLibraries/Macross.Logging.Files/Benchmarks/ProviderComparisonBenchmarks.cs b/ClassLibraries/Macross.Logging.Files/Benchmarks/ProviderComparisonBenchmarks.cs index 86db3c4..93eb30c 100644 --- a/ClassLibraries/Macross.Logging.Files/Benchmarks/ProviderComparisonBenchmarks.cs +++ b/ClassLibraries/Macross.Logging.Files/Benchmarks/ProviderComparisonBenchmarks.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Collections.ObjectModel; using System.Threading; @@ -222,4 +222,4 @@ public void MacrossFileLoggingBenchmark() #endregion } } -#pragma warning restore SA1124 // Do not use regions \ No newline at end of file +#pragma warning restore SA1124 // Do not use regions diff --git a/ClassLibraries/Macross.Logging.Files/CHANGELOG.md b/ClassLibraries/Macross.Logging.Files/CHANGELOG.md index 927d7bd..693bd48 100644 --- a/ClassLibraries/Macross.Logging.Files/CHANGELOG.md +++ b/ClassLibraries/Macross.Logging.Files/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog ## 3.0.0 @@ -11,4 +11,4 @@ * Updated for new [Macross.Logging.Abstractions](../Macross.Logging.Abstractions/README.md) API. -* Performance enhancements. \ No newline at end of file +* Performance enhancements. diff --git a/ClassLibraries/Macross.Logging.Files/Code/BufferWriter.cs b/ClassLibraries/Macross.Logging.Files/Code/BufferWriter.cs index 0f3e7d9..9d6c0b6 100644 --- a/ClassLibraries/Macross.Logging.Files/Code/BufferWriter.cs +++ b/ClassLibraries/Macross.Logging.Files/Code/BufferWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; @@ -55,4 +55,4 @@ private void CheckAndResizeBuffer(int sizeHint) } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.Files/Code/Extensions/FileSystem.cs b/ClassLibraries/Macross.Logging.Files/Code/Extensions/FileSystem.cs index b4442a4..d69a300 100644 --- a/ClassLibraries/Macross.Logging.Files/Code/Extensions/FileSystem.cs +++ b/ClassLibraries/Macross.Logging.Files/Code/Extensions/FileSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace System.IO { @@ -22,4 +22,4 @@ public IEnumerable EnumerateFiles(string path) public IEnumerable EnumerateFiles(string path, string searchPattern, SearchOption searchOption) => Directory.EnumerateFiles(path, searchPattern, searchOption); } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.Files/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.Files/Code/Properties/AssemblyInfo.cs index 56a9452..9f9c7eb 100644 --- a/ClassLibraries/Macross.Logging.Files/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.Files/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -10,4 +10,4 @@ [assembly: InternalsVisibleTo("Macross.Logging.Files.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f18113c4a5e17d17a13467a8d8aea9496b80888c79186fa4bb05627746ce50e31ea03224c4ba07ad2ae23d261739665c844ff56725c83e995e40f9a1ca61aa05577601d27fc786a2b06ecabdf00810652a86b9dab3695b70366c22e60800c0f8efeaef7fc61e43279a41b5587bea01bbe72de1350205c6f8ac06d42e3a8dd4c7")] -[assembly: AssemblyVersion("3.0.0.22082")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.0.22082")] diff --git a/ClassLibraries/Macross.Logging.Files/README.md b/ClassLibraries/Macross.Logging.Files/README.md index 2faa63c..24b501c 100644 --- a/ClassLibraries/Macross.Logging.Files/README.md +++ b/ClassLibraries/Macross.Logging.Files/README.md @@ -292,4 +292,4 @@ pending messages, serialize them, and then write the final output either directly to disk or to a buffer (depending on configuration). This deferral helps with performance but can lead to inconsistent log data if you change your objects quickly after logging them. It is best to log immutable structures or -copies of the things that will be changing very quickly after being logged. \ No newline at end of file +copies of the things that will be changing very quickly after being logged. diff --git a/ClassLibraries/Macross.Logging.Files/Test/LogFileManagerTests.cs b/ClassLibraries/Macross.Logging.Files/Test/LogFileManagerTests.cs index 84730c1..2382e07 100644 --- a/ClassLibraries/Macross.Logging.Files/Test/LogFileManagerTests.cs +++ b/ClassLibraries/Macross.Logging.Files/Test/LogFileManagerTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; @@ -310,4 +310,4 @@ public void ArchiveLogFilesTest() Assert.AreEqual(11, FileSystem.EnumerateFiles(FileLoggerOptions.DefaultLogFileArchiveDirectory).Count()); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.Files/Test/Macross.Logging.Files.Tests.csproj b/ClassLibraries/Macross.Logging.Files/Test/Macross.Logging.Files.Tests.csproj index ff6afe0..67e5669 100644 --- a/ClassLibraries/Macross.Logging.Files/Test/Macross.Logging.Files.Tests.csproj +++ b/ClassLibraries/Macross.Logging.Files/Test/Macross.Logging.Files.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software file logging library tests. diff --git a/ClassLibraries/Macross.Logging.Files/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.Files/Test/Properties/AssemblyInfo.cs index 2b1c3e7..931d384 100644 --- a/ClassLibraries/Macross.Logging.Files/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.Files/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("29e53075-89eb-4b56-a0e4-3ff05251ef92")] -[assembly: AssemblyVersion("0.0.0.20025")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20025")] diff --git a/ClassLibraries/Macross.Logging.Files/Test/TestSystemTime.cs b/ClassLibraries/Macross.Logging.Files/Test/TestSystemTime.cs index 6e4d25a..bdde5e4 100644 --- a/ClassLibraries/Macross.Logging.Files/Test/TestSystemTime.cs +++ b/ClassLibraries/Macross.Logging.Files/Test/TestSystemTime.cs @@ -1,4 +1,4 @@ -namespace System +namespace System { public class TestSystemTime : ISystemTime { @@ -20,4 +20,4 @@ public TestSystemTime( : DateTime.SpecifyKind(new DateTime(year, month, day, hour, minute, second), DateTimeKind.Utc); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Macross.Logging.StandardOutput.Benchmarks.csproj b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Macross.Logging.StandardOutput.Benchmarks.csproj index c06b884..36a6c26 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Macross.Logging.StandardOutput.Benchmarks.csproj +++ b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Macross.Logging.StandardOutput.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net5.0;netcoreapp3.1 + net6.0 true false false diff --git a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Properties/AssemblyInfo.cs index 32e317e..66d409f 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("e5a67469-bb89-497c-86bb-5facc3f93689")] -[assembly: AssemblyVersion("0.0.0.20306")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20306")] diff --git a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/ProviderComparisonBenchmarks.cs b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/ProviderComparisonBenchmarks.cs index 8813942..bc083d1 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/ProviderComparisonBenchmarks.cs +++ b/ClassLibraries/Macross.Logging.StandardOutput/Benchmarks/ProviderComparisonBenchmarks.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Collections.ObjectModel; using System.Threading; @@ -250,4 +250,4 @@ public void MacrossStandardOutputLoggingBenchmark() #endregion } } -#pragma warning restore SA1124 // Do not use regions \ No newline at end of file +#pragma warning restore SA1124 // Do not use regions diff --git a/ClassLibraries/Macross.Logging.StandardOutput/CHANGELOG.md b/ClassLibraries/Macross.Logging.StandardOutput/CHANGELOG.md index 7c02cae..2ffb3bb 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/CHANGELOG.md +++ b/ClassLibraries/Macross.Logging.StandardOutput/CHANGELOG.md @@ -1,8 +1,8 @@ -# Changelog +# Changelog ## 2.0.0 * Updated for new [Macross.Logging.Abstractions](../Macross.Logging.Abstractions/README.md) API. -* Performance enhancements. \ No newline at end of file +* Performance enhancements. diff --git a/ClassLibraries/Macross.Logging.StandardOutput/Code/BufferWriter.cs b/ClassLibraries/Macross.Logging.StandardOutput/Code/BufferWriter.cs index 9ff27ab..2096cf8 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/Code/BufferWriter.cs +++ b/ClassLibraries/Macross.Logging.StandardOutput/Code/BufferWriter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Buffers; using System.IO; @@ -55,4 +55,4 @@ private void CheckAndResizeBuffer(int sizeHint) } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Logging.StandardOutput/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Logging.StandardOutput/Code/Properties/AssemblyInfo.cs index 6272672..3ce62b5 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Logging.StandardOutput/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; @@ -10,4 +10,4 @@ [assembly: InternalsVisibleTo("Macross.Logging.StandardOutput.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f18113c4a5e17d17a13467a8d8aea9496b80888c79186fa4bb05627746ce50e31ea03224c4ba07ad2ae23d261739665c844ff56725c83e995e40f9a1ca61aa05577601d27fc786a2b06ecabdf00810652a86b9dab3695b70366c22e60800c0f8efeaef7fc61e43279a41b5587bea01bbe72de1350205c6f8ac06d42e3a8dd4c7")] -[assembly: AssemblyVersion("2.0.0.21011")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.0.21011")] diff --git a/ClassLibraries/Macross.Logging.StandardOutput/README.md b/ClassLibraries/Macross.Logging.StandardOutput/README.md index 71e02e9..219633b 100644 --- a/ClassLibraries/Macross.Logging.StandardOutput/README.md +++ b/ClassLibraries/Macross.Logging.StandardOutput/README.md @@ -256,4 +256,4 @@ pending messages, serialize them, and then write the final output either directly to disk or to a buffer (depending on configuration). This deferral helps with performance but can lead to inconsistent log data if you change your objects quickly after logging them. It is best to log immutable structures or -copies of the things that will be changing very quickly after being logged. \ No newline at end of file +copies of the things that will be changing very quickly after being logged. diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/CHANGELOG.md b/ClassLibraries/Macross.OpenTelemetry.Extensions/CHANGELOG.md index 95e149e..3ac3002 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/CHANGELOG.md +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/CHANGELOG.md @@ -1,7 +1,7 @@ -# Changelog +# Changelog ## 1.0.0 Beta 6 * `AutomaticallySampleChildren` flag has been added on `ActivityTraceListenerManagerOptions` to disable automatic sampling in cases - where custom sampling logic is already being used. \ No newline at end of file + where custom sampling logic is already being used. diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActionActivityEnrichmentScope.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActionActivityEnrichmentScope.cs index 26f3d68..6592ddb 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActionActivityEnrichmentScope.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActionActivityEnrichmentScope.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; namespace Macross.OpenTelemetry.Extensions @@ -22,4 +22,4 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScope.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScope.cs index b74eeac..5ace62f 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScope.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScope.cs @@ -1,4 +1,4 @@ -using Macross.OpenTelemetry.Extensions; +using Macross.OpenTelemetry.Extensions; namespace System.Diagnostics { @@ -25,4 +25,4 @@ public static IDisposable Begin(Action enrichmentAction) public static IDisposable Begin(ActivityEnricher activityEnricher, TState state) => new GenericActivityEnrichmentScope(activityEnricher, state); } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScopeBase.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScopeBase.cs index 9bc6af6..0232cff 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScopeBase.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/ActivityEnrichmentScopeBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using OpenTelemetry.Context; @@ -60,4 +60,4 @@ protected virtual void Dispose(bool isDisposing) Child = null; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/GenericActivityEnrichmentScope{TState}.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/GenericActivityEnrichmentScope{TState}.cs index 4164a56..8d0619b 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/GenericActivityEnrichmentScope{TState}.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/ActivityEnrichmentScope/GenericActivityEnrichmentScope{TState}.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; namespace Macross.OpenTelemetry.Extensions @@ -25,4 +25,4 @@ protected override void Dispose(bool isDisposing) base.Dispose(isDisposing); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/Properties/AssemblyInfo.cs index 54c1d91..6d1ebe1 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -10,4 +10,4 @@ [assembly: InternalsVisibleTo("Macross.OpenTelemetry.Extensions.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1a4dad5605af5f97a39e67571c3a03a6762442db77512795feb38f00db953d7ec222951dd58cd511610c902b73577beb10f1bc868b539a3d1593ae2037524dbb116e7f137a3bfc8d0c9ad7c2e6ea5bb68a86b5fed17516d6678fd9b899e371a14ea4daca38722b8ca030480c69a418b92f5704b1e2a925e213ef9039b2420e7")] -[assembly: AssemblyVersion("1.0.0.21306")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.0.21306")] diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/README.md b/ClassLibraries/Macross.OpenTelemetry.Extensions/README.md index 5e7e335..3fbb656 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/README.md +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/README.md @@ -315,4 +315,4 @@ To configure options a `configure` callback parameter is provided on the ```csharp services.Configure(_Configuration.GetSection("ActivityTracing")); -``` \ No newline at end of file +``` diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Macross.OpenTelemetry.Extensions.Tests.csproj b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Macross.OpenTelemetry.Extensions.Tests.csproj index 6223ff0..6674ad5 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Macross.OpenTelemetry.Extensions.Tests.csproj +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Macross.OpenTelemetry.Extensions.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.1;netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software OpenTelemetry extensions library tests. diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Properties/AssemblyInfo.cs index 13fbd7b..d88c7cf 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("beb815de-41a4-4cfe-80eb-a5a1d64559c5")] -[assembly: AssemblyVersion("0.0.0.21306")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.21306")] diff --git a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/TestActivityProcessor.cs b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/TestActivityProcessor.cs index 7dec28e..f339a33 100644 --- a/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/TestActivityProcessor.cs +++ b/ClassLibraries/Macross.OpenTelemetry.Extensions/Test/TestActivityProcessor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; @@ -82,4 +82,4 @@ public void Dispose() => _TestActivityProcessor.Reset(); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/EnumerationBenchmarks.cs b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/EnumerationBenchmarks.cs index ed58050..fdeec0c 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/EnumerationBenchmarks.cs +++ b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/EnumerationBenchmarks.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using BenchmarkDotNet.Attributes; @@ -141,4 +141,4 @@ private static bool EnumerateChildListOfStructsAsStructEnumerableForEach(ref lon return true; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/PerformanceBenchmarks.csproj b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/PerformanceBenchmarks.csproj index 398a2ee..e520ddd 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/PerformanceBenchmarks.csproj +++ b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/PerformanceBenchmarks.csproj @@ -2,7 +2,7 @@ Exe - net5.0;netcoreapp3.1;netcoreapp2.1;net48 + net6.0;net48 true false false diff --git a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/Properties/AssemblyInfo.cs index cf0a0c7..ffe9c51 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Benchmarks/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Performance.Extensions/Benchmarks/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("b9c8372c-fd10-447b-a7db-a62a74b48434")] -[assembly: AssemblyVersion("0.0.0.20194")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20194")] diff --git a/ClassLibraries/Macross.Performance.Extensions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Performance.Extensions/Code/Properties/AssemblyInfo.cs index e0556f3..43767c8 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Performance.Extensions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("4f5d8ace-4162-4655-9055-d237e86a8dbd")] -[assembly: AssemblyVersion("0.0.1.21011")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1.21011")] diff --git a/ClassLibraries/Macross.Performance.Extensions/README.md b/ClassLibraries/Macross.Performance.Extensions/README.md index 8daa564..2463036 100644 --- a/ClassLibraries/Macross.Performance.Extensions/README.md +++ b/ClassLibraries/Macross.Performance.Extensions/README.md @@ -1,3 +1,4 @@ # Macross Software Performance Extensions -Macross.Performance.Extensions is a .NET Standard 2.0+ library for augmenting what is provided out of the box for developing high peformance applications. \ No newline at end of file +Macross.Performance.Extensions is a .NET Standard 2.0+ library for augmenting +what is provided out of the box for developing high peformance applications. diff --git a/ClassLibraries/Macross.Performance.Extensions/Test/Macross.Performance.Extensions.Tests.csproj b/ClassLibraries/Macross.Performance.Extensions/Test/Macross.Performance.Extensions.Tests.csproj index 26504e6..7ccc1c5 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Test/Macross.Performance.Extensions.Tests.csproj +++ b/ClassLibraries/Macross.Performance.Extensions/Test/Macross.Performance.Extensions.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software performance extensions library tests. diff --git a/ClassLibraries/Macross.Performance.Extensions/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Performance.Extensions/Test/Properties/AssemblyInfo.cs index 8036b51..ceb766b 100644 --- a/ClassLibraries/Macross.Performance.Extensions/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Performance.Extensions/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("9ce7c797-980c-46d2-9a18-91bf76ed7cc4")] -[assembly: AssemblyVersion("0.0.0.20194")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20194")] diff --git a/ClassLibraries/Macross.ServiceModel.Extensions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.ServiceModel.Extensions/Code/Properties/AssemblyInfo.cs index 52f22dd..1d4e16a 100644 --- a/ClassLibraries/Macross.ServiceModel.Extensions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.ServiceModel.Extensions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("002756ec-091a-4a65-8533-d407b31d7166")] -[assembly: AssemblyVersion("1.0.1.20098")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.1.20098")] diff --git a/ClassLibraries/Macross.ServiceModel.Extensions/README.md b/ClassLibraries/Macross.ServiceModel.Extensions/README.md index 79b20eb..5a3f383 100644 --- a/ClassLibraries/Macross.ServiceModel.Extensions/README.md +++ b/ClassLibraries/Macross.ServiceModel.Extensions/README.md @@ -2,11 +2,23 @@ [![nuget](https://img.shields.io/nuget/v/Macross.ServiceModel.Extensions.svg)](https://www.nuget.org/packages/Macross.ServiceModel.Extensions/) -[Macross.ServiceModel.Extensions](https://www.nuget.org/packages/Macross.ServiceModel.Extensions/) is a .NET Standard 2.0+ library which provides a factory implementation pattern for [WCF](https://github.com/dotnet/wcf) clients (`SoapClient`), closely mirroring what [HttpClientFactory](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests) provides for `HttpClient`s. This is done to help with dependency injection and performance (`ChannelFactory` reuse) when using the WCF API on top of .NET Core. +[Macross.ServiceModel.Extensions](https://www.nuget.org/packages/Macross.ServiceModel.Extensions/) +is a .NET Standard 2.0+ library which provides a factory implementation pattern +for [WCF](https://github.com/dotnet/wcf) clients (`SoapClient`), closely +mirroring what +[HttpClientFactory](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests) +provides for `HttpClient`s. This is done to help with dependency injection and +performance (`ChannelFactory` reuse) when using the WCF API on top of .NET Core. ## SoapClient -The traditional client used by `System.ServiceModel` is `ClientBase` but `ISoapClientFactory` will issue instances of `SoapClient`. What's the differnece? `SoapClient` can be disposed regardless of the state of the connection. `ClientBase` will throw an exception if you dispose a connection in anything other than its happy state. That leads to extra boilerplate being needed, or bugs, so I went a different direction here given there was an opportunity to break with the past. +The traditional client used by `System.ServiceModel` is `ClientBase` but +`ISoapClientFactory` will issue instances of `SoapClient`. What's the +difference? `SoapClient` can be disposed regardless of the state of the +connection. `ClientBase` will throw an exception if you dispose a connection in +anything other than its happy state. That leads to extra boilerplate being +needed, or bugs, so I went a different direction here given there was an +opportunity to break with the past. ## Basic Usage @@ -16,106 +28,116 @@ Here is the most simple way to use the `ISoapClientFactory`: [ServiceContract] public interface ILegacyProductProxy { - [OperationContract] - Task GetStatusAsync(); + [OperationContract] + Task GetStatusAsync(); } public class ProductService : ILegacyProductProxy { - private readonly ILogger _Logger; - private readonly SoapClient _SoapClient; + private readonly ILogger _Logger; + private readonly SoapClient _SoapClient; - public ProductService(ILogger logger, SoapClient soapClient) - { - _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); - _SoapClient = soapClient ?? throw new ArgumentNullException(nameof(soapClient)); - } + public ProductService(ILogger logger, SoapClient soapClient) + { + _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _SoapClient = soapClient ?? throw new ArgumentNullException(nameof(soapClient)); + } - public Task GetStatusAsync() => _SoapClient.Channel.GetStatusAsync(); + public Task GetStatusAsync() => _SoapClient.Channel.GetStatusAsync(); } public void ConfigureServices(IServiceCollection services) { - services.AddSoapClient(() - => new ChannelFactory( - new BasicHttpBinding(), - new EndpointAddress("http://localhost/LegacyService/"))); + services.AddSoapClient(() + => new ChannelFactory( + new BasicHttpBinding(), + new EndpointAddress("http://localhost/LegacyService/"))); } ``` -In this case `ProductService` is injected with its very own instance of `SoapClient` implementing the `ILegacyProductProxy` WCF contract each and every time someone asks for it. Under the hood the `ISoapClientFactory` will reuse a `ChannelFactory` so we only pay the penalty of parsing the contract information once. `ProductService` doesn't have to worry about the underlying `ChannelFactory`, correctly using the resources, or even cleaning things up when its done. +In this case `ProductService` is injected with its very own instance of +`SoapClient` implementing the `ILegacyProductProxy` WCF contract each and every +time someone asks for it. Under the hood the `ISoapClientFactory` will reuse a +`ChannelFactory` so we only pay the penalty of parsing the contract information +once. `ProductService` doesn't have to worry about the underlying +`ChannelFactory`, correctly using the resources, or even cleaning things up when +its done. ## Advanced Usage Here's a more advanced example which shows off more of the feature set: -* Reloading of the `ChannelFactory` when options change. Admittedly, it's not the most elegant mechanism. Open to suggestions! +* Reloading of the `ChannelFactory` when options change. Admittedly, it's not + the most elegant mechanism. Open to suggestions! * Configuring the `ChannelFactory` using a delegate. * Registering an `IEndpointBehavior` into the `ChannelFactory`. -* Separating the `TChannel` interface from the `TClient` interface. In the example `IProductService` is registered for `ProductService` but `SoapClient` is actually injected. I added that because I wanted to put a new API in front of an old legacy WCF service. +* Separating the `TChannel` interface from the `TClient` interface. In the + example `IProductService` is registered for `ProductService` but + `SoapClient` is actually injected. I added that because I + wanted to put a new API in front of an old legacy WCF service. ```csharp public void ConfigureServices(IServiceCollection services) { - IDisposable? ChangeWatcher = null; - services - .AddSoapClient((serviceProvider, factory) => - { - IOptionsMonitor Options = serviceProvider.GetRequiredService>(); - - if (ChangeWatcher != null) - ChangeWatcher.Dispose(); - ChangeWatcher = Options.OnChange(_ => factory.Invalidate()); - - WSHttpBinding WSHttpBinding = new WSHttpBinding(); - WSHttpBinding.Security.Mode = Options.CurrentValue.ServiceUrl.Scheme == "https" ? SecurityMode.Transport : SecurityMode.None; - WSHttpBinding.MaxReceivedMessageSize = int.MaxValue; - - return new ChannelFactory( - WSHttpBinding, - new EndpointAddress(Options.CurrentValue.ServiceUrl)); - }) - .ConfigureChannelFactory(channelFactory => channelFactory.Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials) - .AddEndpointBehavior(); + IDisposable? ChangeWatcher = null; + services + .AddSoapClient((serviceProvider, factory) => + { + IOptionsMonitor Options = serviceProvider.GetRequiredService>(); + + if (ChangeWatcher != null) + ChangeWatcher.Dispose(); + ChangeWatcher = Options.OnChange(_ => factory.Invalidate()); + + WSHttpBinding WSHttpBinding = new WSHttpBinding(); + WSHttpBinding.Security.Mode = Options.CurrentValue.ServiceUrl.Scheme == "https" ? SecurityMode.Transport : SecurityMode.None; + WSHttpBinding.MaxReceivedMessageSize = int.MaxValue; + + return new ChannelFactory( + WSHttpBinding, + new EndpointAddress(Options.CurrentValue.ServiceUrl)); + }) + .ConfigureChannelFactory(channelFactory => channelFactory.Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials) + .AddEndpointBehavior(); } public class ProductServiceOptions { - public Uri ServiceUrl { get; set; } + public Uri ServiceUrl { get; set; } } public interface IProductService { - Task EnsureStatus(int status); + Task EnsureStatus(int status); } public class ProductService : IProductService { - private readonly ILogger _Logger; - private readonly SoapClient _SoapClient; - - public ProductService(ILogger logger, SoapClient soapClient) - { - _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); - _SoapClient = soapClient ?? throw new ArgumentNullException(nameof(soapClient)); - } - - public async Task EnsureStatus(int status) - { - if (await _SoapClient.Channel.GetStatusAsync().ConfigureAwait(false) != status) - throw new InvalidOperationException(); - } + private readonly ILogger _Logger; + private readonly SoapClient _SoapClient; + + public ProductService(ILogger logger, SoapClient soapClient) + { + _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _SoapClient = soapClient ?? throw new ArgumentNullException(nameof(soapClient)); + } + + public async Task EnsureStatus(int status) + { + if (await _SoapClient.Channel.GetStatusAsync().ConfigureAwait(false) != status) + throw new InvalidOperationException(); + } } [ServiceContract] public interface ILegacyProductProxy { - [OperationContract] - Task GetStatusAsync(); + [OperationContract] + Task GetStatusAsync(); } public class CustomEndpointBehavior : IEndpointBehavior { - // Endpoint behavior logic goes here. + // Endpoint behavior logic goes here. } -``` \ No newline at end of file +``` diff --git a/ClassLibraries/Macross.ServiceModel.Extensions/Test/Macross.ServiceModel.Extensions.Tests.csproj b/ClassLibraries/Macross.ServiceModel.Extensions/Test/Macross.ServiceModel.Extensions.Tests.csproj index b81e613..a374d11 100644 --- a/ClassLibraries/Macross.ServiceModel.Extensions/Test/Macross.ServiceModel.Extensions.Tests.csproj +++ b/ClassLibraries/Macross.ServiceModel.Extensions/Test/Macross.ServiceModel.Extensions.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1;net5.0 + net6.0 true keypair.snk Macross Software System.ServiceModel extensions library tests. diff --git a/ClassLibraries/Macross.ServiceModel.Extensions/Test/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.ServiceModel.Extensions/Test/Properties/AssemblyInfo.cs index 179b1dd..d5fa7a9 100644 --- a/ClassLibraries/Macross.ServiceModel.Extensions/Test/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.ServiceModel.Extensions/Test/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("dc042124-75bf-4b79-959b-1c78bf39e245")] -[assembly: AssemblyVersion("0.0.0.20025")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20025")] diff --git a/ClassLibraries/Macross.ServiceModel.Extensions/Test/SoapServiceCollectionExtensionsTests.cs b/ClassLibraries/Macross.ServiceModel.Extensions/Test/SoapServiceCollectionExtensionsTests.cs index b6bb6f8..a65959c 100644 --- a/ClassLibraries/Macross.ServiceModel.Extensions/Test/SoapServiceCollectionExtensionsTests.cs +++ b/ClassLibraries/Macross.ServiceModel.Extensions/Test/SoapServiceCollectionExtensionsTests.cs @@ -3,7 +3,6 @@ using System.ServiceModel.Channels; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; -using System.Linq; using Microsoft.Extensions.DependencyInjection; diff --git a/ClassLibraries/Macross.Windows.Debugging/CHANGELOG.md b/ClassLibraries/Macross.Windows.Debugging/CHANGELOG.md index 6f8d24b..d6910c3 100644 --- a/ClassLibraries/Macross.Windows.Debugging/CHANGELOG.md +++ b/ClassLibraries/Macross.Windows.Debugging/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog ## 2.0.0 @@ -8,4 +8,4 @@ * Updated for new [Macross.Logging.Abstractions](../Macross.Logging.Abstractions/README.md) API. -* Added net5.0-windows target. \ No newline at end of file +* Added net5.0-windows target. diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowHost.cs b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowHost.cs index d4061bf..bd8dbe4 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowHost.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowHost.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Threading; using System.Windows.Forms; @@ -86,4 +86,4 @@ private void FormThreadBody(object? state) _ClosedEventHandler?.Invoke(this, EventArgs.Empty); } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowLoggerOptions.cs b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowLoggerOptions.cs index af7f775..85cd25c 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowLoggerOptions.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowLoggerOptions.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using System.Text.Json.Serialization; using System.Diagnostics; using System.Text.Encodings.Web; using System.Collections.Generic; @@ -64,7 +65,7 @@ public class DebugWindowLoggerOptions /// public static JsonSerializerOptions DefaultJsonOptions { get; } = new JsonSerializerOptions { - IgnoreNullValues = true, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, WriteIndented = true, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }; diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowTabPage.cs b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowTabPage.cs index dabc617..8bb4697 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowTabPage.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Code/DebugWindowTabPage.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading; using System.Windows.Forms; @@ -150,4 +150,4 @@ private void OnClearLogButtonClick(object? sender, EventArgs e) } } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/DebuggingExtensions.cs b/ClassLibraries/Macross.Windows.Debugging/Code/DebuggingExtensions.cs index d04dabf..56088fc 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/DebuggingExtensions.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Code/DebuggingExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; using Microsoft.Extensions.Configuration; @@ -89,4 +89,4 @@ public static IHostBuilder ConfigureDebugWindow( return hostBuilder; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/Macross.Windows.Debugging.csproj b/ClassLibraries/Macross.Windows.Debugging/Code/Macross.Windows.Debugging.csproj index 8472e8c..a69bb01 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/Macross.Windows.Debugging.csproj +++ b/ClassLibraries/Macross.Windows.Debugging/Code/Macross.Windows.Debugging.csproj @@ -2,7 +2,7 @@ Library - netcoreapp3.1;net5.0-windows + net6.0-windows true True keypair.snk diff --git a/ClassLibraries/Macross.Windows.Debugging/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Debugging/Code/Properties/AssemblyInfo.cs index fdec1b1..5e2ba76 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("7936396a-8e58-47ba-835a-1b2ec7369ede")] -[assembly: AssemblyVersion("2.0.0.21019")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.0.21019")] diff --git a/ClassLibraries/Macross.Windows.Debugging/Demo/Controllers/WeatherForecastController.cs b/ClassLibraries/Macross.Windows.Debugging/Demo/Controllers/WeatherForecastController.cs index 015c8ee..cbf52b6 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Demo/Controllers/WeatherForecastController.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Demo/Controllers/WeatherForecastController.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; @@ -45,4 +45,4 @@ public async Task GetWeatherForecast(int postalCode) return WeatherForecast; } } -} \ No newline at end of file +} diff --git a/ClassLibraries/Macross.Windows.Debugging/Demo/DemoWebApplication.csproj b/ClassLibraries/Macross.Windows.Debugging/Demo/DemoWebApplication.csproj index d61f6b9..aa59d7b 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Demo/DemoWebApplication.csproj +++ b/ClassLibraries/Macross.Windows.Debugging/Demo/DemoWebApplication.csproj @@ -9,12 +9,12 @@ - net5.0-windows + net6.0-windows WINDOWS - net5.0 + net6.0 diff --git a/ClassLibraries/Macross.Windows.Debugging/Demo/Program.cs b/ClassLibraries/Macross.Windows.Debugging/Demo/Program.cs index 134bf2d..7246c46 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Demo/Program.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Demo/Program.cs @@ -19,7 +19,7 @@ public static async Task Main(string[] args) IHost host = CreateHostBuilder(args).Build(); ILogger log = host.Services.GetRequiredService() - .CreateLogger(typeof(Program).FullName); + .CreateLogger(typeof(Program).FullName!); using IDisposable group = log.BeginGroup("Main"); diff --git a/ClassLibraries/Macross.Windows.Debugging/Demo/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Debugging/Demo/Properties/AssemblyInfo.cs index c1ee151..f3ec085 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Demo/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Demo/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("b2e9e27f-d451-4f83-bc06-958127a71af4")] -[assembly: AssemblyVersion("0.0.0.21019")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.21019")] diff --git a/ClassLibraries/Macross.Windows.Debugging/Demo/README.md b/ClassLibraries/Macross.Windows.Debugging/Demo/README.md index af5b566..ad381da 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Demo/README.md +++ b/ClassLibraries/Macross.Windows.Debugging/Demo/README.md @@ -1,4 +1,4 @@ -# Macross Software Demo Application +# Macross Software Demo Application A simple demo application using [Macross.Logging.Files](../../Macross.Logging.Files/README.md) and [Macross.Windows.Debugging](../README.md). @@ -6,121 +6,121 @@ A simple demo application using [Macross.Logging.Files](../../Macross.Logging.Fi * Feature registration is done via `ConfigureLogging` and `ConfigureDebugWindow` called in `Program.cs`: - ```csharp - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host - .CreateDefaultBuilder(args) - #if WINDOWS && DEBUG - .ConfigureDebugWindow() - #endif - .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()) - .ConfigureLogging((builder) => builder.AddFiles(options => options.IncludeGroupNameInFileName = true)); - } - ``` - - Logging into files by group is turned on. + ```csharp + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host + .CreateDefaultBuilder(args) + #if WINDOWS && DEBUG + .ConfigureDebugWindow() + #endif + .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup()) + .ConfigureLogging((builder) => builder.AddFiles(options => options.IncludeGroupNameInFileName = true)); + } + ``` + + Logging into files by group is turned on. * The `WINDOWS` constant is set in `csproj`: - ```xml - - net5.0-windows - WINDOWS - + ```xml + + net5.0-windows + WINDOWS + - - net5.0 - - ``` + + net5.0 + + ``` * `appsettings.Development.json` has some configuration targeted for development: - ```json - { - "Logging": { - "LogLevel": { - "DemoWebApplication": "Debug", - "DemoWebApplication.MessageSpamBackgroundService": "Warning" - } - } - } + ```json + { + "Logging": { + "LogLevel": { + "DemoWebApplication": "Debug", + "DemoWebApplication.MessageSpamBackgroundService": "Warning" + } + } + } - ``` + ``` - The `MessageSpamBackgroundService` writes a lot of spam (by design), the "Warning" rule demonstrates how to filter that out when debugging. + The `MessageSpamBackgroundService` writes a lot of spam (by design), the "Warning" rule demonstrates how to filter that out when debugging. * `Properties\launchSettings.json` has been customized so IIS Express debugging is not the default launch setting. Launching via the compiled executable will give the best experience when combined with the `DebugWindow`. * A custom (somewhat experimental) middleware has been provided (`Middleware\RequestTraceMiddleware.cs`) which will group log messages by routes and then trace them out to logs as the Http pipeline is executed. It will also log raw request and response bodies when debugging. I have it configured to only log bodies for JSON & XML responses, but you can tweak that in your own applications. Here's an example of the output: - ```json - { - "TimestampUtc": "2020-02-02T18:26:12.0192317Z", - "ThreadId": 15, - "LogLevel": "Information", - "GroupName": "WeatherForecast", - "CategoryName": "DemoWebApplication.RequestTraceMiddleware", - "Content": "REQ", - "RequestId": "0HLT81LCG66U6:00000003", - "RequestPath": "/api/WeatherForecast", - "SpanId": "8911b2e83f658a4e", - "TraceId": "c5dc1ceb867e44449789e8669d6f7eae", - "ParentId": "0000000000000000", - "RemoteEndpoint": "::1:64468", - "Protocol": "HTTP/2", - "Method": "GET", - "Scheme": "https", - "Path": "/api/WeatherForecast", - "QueryString": "?postalCode=90210", - "Headers": { - "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", - "Accept-Encoding": "gzip, deflate, br", - "Accept-Language": "en-US,en;q=0.9", - "Host": "localhost:5001", - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71", - "Upgrade-Insecure-Requests": "1", - ":method": "GET", - ":authority": "localhost:5001", - ":scheme": "https", - ":path": "/api/WeatherForecast?postalCode=90210", - "sec-fetch-user": "?1", - "sec-fetch-site": "none", - "sec-fetch-mode": "navigate" - }, - "Cookies": {}, - "Body": "" - } - { - "TimestampUtc": "2020-02-02T18:26:12.0592014Z", - "ThreadId": 15, - "LogLevel": "Information", - "GroupName": "WeatherForecast", - "CategoryName": "DemoWebApplication.RequestTraceMiddleware", - "Content": "RSP", - "RequestId": "0HLT81LCG66U6:00000003", - "RequestPath": "/api/WeatherForecast", - "SpanId": "8911b2e83f658a4e", - "TraceId": "c5dc1ceb867e44449789e8669d6f7eae", - "ParentId": "0000000000000000", - "StatusCode": 200, - "Headers": { - "Content-Type": "application/json; charset=utf-8" - }, - "Cookies": {}, - "Body": "{\"postalCode\":90210,\"friendlyName\":\"Blanchtown\",\"highTemperatureInFahrenheitDegrees\":70,\"lowTemperatureInFahrenheitDegrees\":50,\"forecastGoodUntilTime\":\"2020-02-02T10:26:42.041683-08:00\"}", - "ElapsedMilliseconds": 38.9791 - } - ``` - - The `RequestTraceMiddleware` is registered in `Startup.cs`: - - ```csharp - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseMiddleware(); - ... - } - ``` - - Note: It has to be the first middleware registered to be useful. \ No newline at end of file + ```json + { + "TimestampUtc": "2020-02-02T18:26:12.0192317Z", + "ThreadId": 15, + "LogLevel": "Information", + "GroupName": "WeatherForecast", + "CategoryName": "DemoWebApplication.RequestTraceMiddleware", + "Content": "REQ", + "RequestId": "0HLT81LCG66U6:00000003", + "RequestPath": "/api/WeatherForecast", + "SpanId": "8911b2e83f658a4e", + "TraceId": "c5dc1ceb867e44449789e8669d6f7eae", + "ParentId": "0000000000000000", + "RemoteEndpoint": "::1:64468", + "Protocol": "HTTP/2", + "Method": "GET", + "Scheme": "https", + "Path": "/api/WeatherForecast", + "QueryString": "?postalCode=90210", + "Headers": { + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US,en;q=0.9", + "Host": "localhost:5001", + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71", + "Upgrade-Insecure-Requests": "1", + ":method": "GET", + ":authority": "localhost:5001", + ":scheme": "https", + ":path": "/api/WeatherForecast?postalCode=90210", + "sec-fetch-user": "?1", + "sec-fetch-site": "none", + "sec-fetch-mode": "navigate" + }, + "Cookies": {}, + "Body": "" + } + { + "TimestampUtc": "2020-02-02T18:26:12.0592014Z", + "ThreadId": 15, + "LogLevel": "Information", + "GroupName": "WeatherForecast", + "CategoryName": "DemoWebApplication.RequestTraceMiddleware", + "Content": "RSP", + "RequestId": "0HLT81LCG66U6:00000003", + "RequestPath": "/api/WeatherForecast", + "SpanId": "8911b2e83f658a4e", + "TraceId": "c5dc1ceb867e44449789e8669d6f7eae", + "ParentId": "0000000000000000", + "StatusCode": 200, + "Headers": { + "Content-Type": "application/json; charset=utf-8" + }, + "Cookies": {}, + "Body": "{\"postalCode\":90210,\"friendlyName\":\"Blanchtown\",\"highTemperatureInFahrenheitDegrees\":70,\"lowTemperatureInFahrenheitDegrees\":50,\"forecastGoodUntilTime\":\"2020-02-02T10:26:42.041683-08:00\"}", + "ElapsedMilliseconds": 38.9791 + } + ``` + + The `RequestTraceMiddleware` is registered in `Startup.cs`: + + ```csharp + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + app.UseMiddleware(); + ... + } + ``` + + Note: It has to be the first middleware registered to be useful. diff --git a/ClassLibraries/Macross.Windows.Debugging/README.md b/ClassLibraries/Macross.Windows.Debugging/README.md index 3cc32dd..ccae370 100644 --- a/ClassLibraries/Macross.Windows.Debugging/README.md +++ b/ClassLibraries/Macross.Windows.Debugging/README.md @@ -356,11 +356,11 @@ otherwise routing information won't be available. ## Writing the flattened message JSON structure to actual log files... -If you find the flattened message JSON format displayed in the UI conveniant and +If you find the flattened message JSON format displayed in the UI convenient and want to write it out into actual log files, see [Macross.Logging.Files](../Macross.Logging.Files/README.md). To write it out to Console (stdout), see [Macross.Logging.StandardOutput](../Macross.Logging.StandardOutput/README.md). A demo web application using the `DebugWindow` and `Macross.Logging.Files` is -available [here](./Demo/README.md). \ No newline at end of file +available [here](./Demo/README.md). diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/Properties/AssemblyInfo.cs index 1d93bd9..50f6c78 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("e6ebb5c7-8d0e-4ddf-a862-b1af8ca8adbd")] -[assembly: AssemblyVersion("0.0.0.20331")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20331")] diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/TestConsoleApp.csproj b/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/TestConsoleApp.csproj index 8ab5b75..7522c1f 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/TestConsoleApp.csproj +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestConsoleApp/TestConsoleApp.csproj @@ -10,12 +10,12 @@ - net5.0-windows + net6.0-windows WINDOWS - net5.0 + net6.0 diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Program.cs b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Program.cs index 51c4db1..9c3a73a 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Program.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Program.cs @@ -1,4 +1,6 @@ +#if WINDOWS && DEBUG using System.Drawing; +#endif using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Properties/AssemblyInfo.cs index c788bcb..1eaa66e 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("8953327e-9c2f-4310-a17e-26f5612a77c3")] -[assembly: AssemblyVersion("0.0.0.20331")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20331")] diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/TestWebApplication.csproj b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/TestWebApplication.csproj index c5a9ce6..28e187e 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/TestWebApplication.csproj +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestWebApplication/TestWebApplication.csproj @@ -9,12 +9,12 @@ - net5.0-windows + net6.0-windows WINDOWS - net5.0 + net6.0 diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/Properties/AssemblyInfo.cs index 26e5983..5d1e3ee 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("4b5ee816-d8cb-4e43-8386-e3ac9453b609")] -[assembly: AssemblyVersion("0.0.0.20331")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.0.20331")] diff --git a/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/TestWindowsService.csproj b/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/TestWindowsService.csproj index 2be4a36..fa7f8ff 100644 --- a/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/TestWindowsService.csproj +++ b/ClassLibraries/Macross.Windows.Debugging/Test/TestWindowsService/TestWindowsService.csproj @@ -15,12 +15,12 @@ - net5.0-windows + net6.0-windows WINDOWS - net5.0 + net6.0 diff --git a/ClassLibraries/Macross.Windows.Impersonation/Code/Macross.Windows.Impersonation.csproj b/ClassLibraries/Macross.Windows.Impersonation/Code/Macross.Windows.Impersonation.csproj index 5336a95..1c33d3b 100644 --- a/ClassLibraries/Macross.Windows.Impersonation/Code/Macross.Windows.Impersonation.csproj +++ b/ClassLibraries/Macross.Windows.Impersonation/Code/Macross.Windows.Impersonation.csproj @@ -1,7 +1,7 @@  - net5.0-windows;netstandard2.1;netstandard2.0;net48 + net6.0-windows;netstandard2.1;netstandard2.0;net48 True keypair.snk diff --git a/ClassLibraries/Macross.Windows.Impersonation/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Impersonation/Code/Properties/AssemblyInfo.cs index 5dccd26..1a08fda 100644 --- a/ClassLibraries/Macross.Windows.Impersonation/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Impersonation/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("abfdf6e9-2b65-4aec-8de3-2a00aa5fa68b")] -[assembly: AssemblyVersion("0.0.1.20011")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1.20011")] diff --git a/ClassLibraries/Macross.Windows.Impersonation/README.md b/ClassLibraries/Macross.Windows.Impersonation/README.md index aceca9a..932dac9 100644 --- a/ClassLibraries/Macross.Windows.Impersonation/README.md +++ b/ClassLibraries/Macross.Windows.Impersonation/README.md @@ -1,3 +1,4 @@ # Macross Software Impersonation -Macross.Windows.Impersonation is a .NET Standard 2.0+ library for augmenting what is provided by the framework for impersonation on Windows. \ No newline at end of file +Macross.Windows.Impersonation is a .NET Standard 2.0+ library for augmenting +what is provided by the framework for impersonation on Windows. diff --git a/ClassLibraries/Macross.Windows.Permissions/Code/Macross.Windows.Permissions.csproj b/ClassLibraries/Macross.Windows.Permissions/Code/Macross.Windows.Permissions.csproj index adee74d..23b967b 100644 --- a/ClassLibraries/Macross.Windows.Permissions/Code/Macross.Windows.Permissions.csproj +++ b/ClassLibraries/Macross.Windows.Permissions/Code/Macross.Windows.Permissions.csproj @@ -1,7 +1,7 @@  - net5.0-windows;netstandard2.1;netstandard2.0 + net6.0-windows;netstandard2.1;netstandard2.0 True keypair.snk diff --git a/ClassLibraries/Macross.Windows.Permissions/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.Permissions/Code/Properties/AssemblyInfo.cs index c35bc5c..9cade79 100644 --- a/ClassLibraries/Macross.Windows.Permissions/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.Permissions/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("97eec3c2-2e9e-4a36-aeef-86fe325ac18e")] -[assembly: AssemblyVersion("0.0.1.20011")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1.20011")] diff --git a/ClassLibraries/Macross.Windows.Permissions/README.md b/ClassLibraries/Macross.Windows.Permissions/README.md index b0e00ab..068bd74 100644 --- a/ClassLibraries/Macross.Windows.Permissions/README.md +++ b/ClassLibraries/Macross.Windows.Permissions/README.md @@ -1,3 +1,4 @@ # Macross Software Permissions -Macross.Windows.Permissions is a .NET Standard 2.0+ library for augmenting what is provided by the framework for permissions on Windows. \ No newline at end of file +Macross.Windows.Permissions is a .NET Standard 2.0+ library for augmenting what +is provided by the framework for permissions on Windows. diff --git a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Macross.Windows.ServiceManagement.csproj b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Macross.Windows.ServiceManagement.csproj index b421ed8..6460e42 100644 --- a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Macross.Windows.ServiceManagement.csproj +++ b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Macross.Windows.ServiceManagement.csproj @@ -1,15 +1,15 @@  - net5.0-windows;netstandard2.1;netstandard2.0 + net6.0-windows;netstandard2.1;netstandard2.0 True keypair.snk Macross Software Windows service management library. - Provides an API for managing Windows services. Operations inlcuded: create, delete, query, start, stop, pause, & continue. + Provides an API for managing Windows services. Operations included: create, delete, query, start, stop, pause, & continue. - Contains similiar functionality to what is provided in System.ServiceProcess but also adds in Create & Delete operations to replace (in spirit) what ServiceProcessInstaller & ServiceInstaller from System.Configuration.Install provided in .NET Framework. + Contains similar functionality to what is provided in System.ServiceProcess but also adds in Create & Delete operations to replace (in spirit) what ServiceProcessInstaller & ServiceInstaller from System.Configuration.Install provided in .NET Framework. Provides an asynchronous WaitForStatus method. diff --git a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Properties/AssemblyInfo.cs b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Properties/AssemblyInfo.cs index f35eecd..c373f85 100644 --- a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Properties/AssemblyInfo.cs +++ b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Reflection; using System.Runtime.InteropServices; @@ -7,4 +7,4 @@ [assembly: Guid("8983470e-ee87-4178-9db1-e58304a0499f")] -[assembly: AssemblyVersion("0.0.1.20011")] \ No newline at end of file +[assembly: AssemblyVersion("0.0.1.20011")] diff --git a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Service.cs b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Service.cs index 7669240..668d2bb 100644 --- a/ClassLibraries/Macross.Windows.ServiceManagement/Code/Service.cs +++ b/ClassLibraries/Macross.Windows.ServiceManagement/Code/Service.cs @@ -150,7 +150,7 @@ public void Start(string?[]? arguments) for (ArgumentIndex = 0; ArgumentIndex < arguments.Length; ArgumentIndex++) { if (arguments[ArgumentIndex] == null) - throw new ArgumentException($"Argument at index {ArgumentIndex} is null which cannot be passed to sevice.", nameof(arguments)); + throw new ArgumentException($"Argument at index {ArgumentIndex} is null which cannot be passed to service.", nameof(arguments)); ArumentPointers[ArgumentIndex] = Marshal.StringToHGlobalUni(arguments[ArgumentIndex]); } diff --git a/ClassLibraries/Macross.Windows.ServiceManagement/README.md b/ClassLibraries/Macross.Windows.ServiceManagement/README.md index cdcf9e8..6390f20 100644 --- a/ClassLibraries/Macross.Windows.ServiceManagement/README.md +++ b/ClassLibraries/Macross.Windows.ServiceManagement/README.md @@ -1,3 +1,4 @@ # Macross Software Service Management -Macross.Windows.ServiceManagement is a .NET Standard 2.0+ library for augmenting what is provided by the framework for management of services on Windows. \ No newline at end of file +Macross.Windows.ServiceManagement is a .NET Standard 2.0+ library for augmenting +what is provided by the framework for management of services on Windows. diff --git a/Directory.Build.props b/Directory.Build.props index c431405..5ca3c15 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,35 +1,45 @@ - - preview - enable - $(MSBuildThisFileDirectory)CodeAnalysis.ruleset - git - https://github.com/Macross-Software/core - true - true - snupkg - Macross Software - Copyright © $([System.DateTime]::Now.ToString(yyyy)) - MIT - + + $([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory)).FullName) + preview + enable + $(MSBuildThisFileDirectory)CodeAnalysis.ruleset + true + true + git + https://github.com/Macross-Software/core + true + true + snupkg + Macross Software + Copyright © $([System.DateTime]::Now.ToString(yyyy)) + MIT + - - $(NoWarn);8600;8601;8602;8603;8604 - + + $(NoWarn);8600;8601;8602;8603;8604 + - - true - + + $(NoWarn);CS1591 + - - - - - - + + true + true + - - - - - \ No newline at end of file + + + + + + + + + + + + diff --git a/Macross-Master.sln b/Macross-Master.sln index 6af1428..57bec15 100644 --- a/Macross-Master.sln +++ b/Macross-Master.sln @@ -123,11 +123,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PerformanceBenchmarks", "Cl EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Macross.Performance.Extensions", "ClassLibraries\Macross.Performance.Extensions\Code\Macross.Performance.Extensions.csproj", "{9D942AFE-6409-4DB1-A52A-0B01E7154C48}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{B385A7A3-E7B8-469E-8BB4-48A12A6031A1}" - ProjectSection(SolutionItems) = preProject - Build\Gated Build Pipeline.yml = Build\Gated Build Pipeline.yml - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Macross.Performance.Extensions.Tests", "ClassLibraries\Macross.Performance.Extensions\Test\Macross.Performance.Extensions.Tests.csproj", "{E1D29AFA-F163-4A29-A3B8-C474DB496BCF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Macross.Logging.StandardOutput", "Macross.Logging.StandardOutput", "{BB4BBB29-7C73-43A0-9715-AC47C0C14642}" @@ -150,6 +145,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Macross.OpenTelemetry.Exten EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Macross.OpenTelemetry.Extensions.Tests", "ClassLibraries\Macross.OpenTelemetry.Extensions\Test\Macross.OpenTelemetry.Extensions.Tests.csproj", "{0AA47B42-FFB2-49F7-BA03-9D9097D6EE6E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{61DFC395-81DA-4EBD-8672-2F4BBEDE385F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{A39E447F-D93F-4300-A6C1-EC1B3A7376E3}" + ProjectSection(SolutionItems) = preProject + .github\workflows\ci.yml = .github\workflows\ci.yml + .github\workflows\Component.BuildTest.yml = .github\workflows\Component.BuildTest.yml + .github\workflows\dotnet-format.yml = .github\workflows\dotnet-format.yml + .github\workflows\markdownlint.yml = .github\workflows\markdownlint.yml + .github\workflows\sanitycheck.yml = .github\workflows\sanitycheck.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -296,12 +302,12 @@ Global {43B4D6A6-A9B3-45B0-AC59-2D8055E36472} = {8F8C2FCE-48CC-42BA-8572-E6DC015C37D8} {567CD293-28B0-469E-BE04-27CE4567C9A7} = {0A5507A8-7905-43BC-BEF6-4A03F1A03056} {9D942AFE-6409-4DB1-A52A-0B01E7154C48} = {0A5507A8-7905-43BC-BEF6-4A03F1A03056} - {B385A7A3-E7B8-469E-8BB4-48A12A6031A1} = {57E682E8-B415-492D-9AE0-7D5D5FC58230} {E1D29AFA-F163-4A29-A3B8-C474DB496BCF} = {0A5507A8-7905-43BC-BEF6-4A03F1A03056} {B8B9C3D4-C72A-4DB5-A10E-F1FA4D43CB25} = {BB4BBB29-7C73-43A0-9715-AC47C0C14642} {576563CB-FE9A-4482-97B3-571F6C479F9E} = {BB4BBB29-7C73-43A0-9715-AC47C0C14642} {8E763F6E-30F7-4D58-B2EF-C88697E68A5C} = {C91BFF20-3419-4C6B-B729-476496C632DD} {0AA47B42-FFB2-49F7-BA03-9D9097D6EE6E} = {C91BFF20-3419-4C6B-B729-476496C632DD} + {A39E447F-D93F-4300-A6C1-EC1B3A7376E3} = {61DFC395-81DA-4EBD-8672-2F4BBEDE385F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8D27B7B0-BD74-4094-96C3-490528274426} diff --git a/NuGet.config b/NuGet.config index 9dac91f..92ffd56 100644 --- a/NuGet.config +++ b/NuGet.config @@ -10,4 +10,4 @@ - \ No newline at end of file + diff --git a/README.md b/README.md index 5cc42f9..39a96c1 100644 --- a/README.md +++ b/README.md @@ -34,4 +34,4 @@ This repo contains open source Macross Software projects. ## Contacts -* Blanch - https://blog.macrosssoftware.com \ No newline at end of file +* Blanch - https://blog.macrosssoftware.com diff --git a/sanitycheck.py b/sanitycheck.py new file mode 100644 index 0000000..e3ae7b9 --- /dev/null +++ b/sanitycheck.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 + +import glob +import os +import sys + +CR = b'\r' +CRLF = b'\r\n' +LF = b'\n' + +def sanitycheck(pattern, allow_utf8 = False, allow_eol = (CRLF, LF), indent = 1): + error_count = 0 + + for filename in glob.glob(pattern, recursive=True): + if not os.path.isfile(filename): + continue + with open(filename, 'rb') as file: + content = file.read() + error = [] + eol = None + lineno = 1 + if not content: + error.append(' Empty file found') + elif content[-1] != 10: # LF + error.append(' Missing a blank line before EOF') + for line in content.splitlines(True): + if allow_utf8 and lineno == 1 and line.startswith(b'\xef\xbb\xbf'): + line = line[3:] + if any(b == 7 for b in line): + error.append(' TAB found at Ln:{} {}'.format(lineno, line)) + if any(b > 127 for b in line): + error.append(' Non-ASCII character found at Ln:{} {}'.format(lineno, line)) + if line[-2:] == CRLF: + if not eol: + eol = CRLF + elif eol != CRLF: + error.append(' Inconsistent line ending found at Ln:{} {}'.format(lineno, line)) + line = line[:-2] + elif line[-1:] == LF: + if not eol: + eol = LF + elif eol != LF: + error.append(' Inconsistent line ending found at Ln:{} {}'.format(lineno, line)) + line = line[:-1] + elif line[-1:] == CR: + error.append(' CR found at Ln:{} {}'.format(lineno, line)) + line = line[:-1] + if eol: + if eol not in allow_eol: + error.append(' Line ending {} not allowed at Ln:{}'.format(eol, lineno)) + break + if line.startswith(b' '): + spc_count = 0 + for c in line: + if c != 32: + break + spc_count += 1 + if not indent or spc_count % indent: + error.append(' {} SPC found at Ln:{} {}'.format(spc_count, lineno, line)) + if line[-1:] == b' ' or line[-1:] == b'\t': + error.append(' Trailing space found at Ln:{} {}'.format(lineno, line)) + lineno += 1 + if error: + error_count += 1 + print('{} [FAIL]'.format(filename), file=sys.stderr) + for msg in error: + print(msg, file=sys.stderr) + else: + # print('{} [PASS]'.format(filename)) + pass + + return error_count + +retval = 0 +retval += sanitycheck('.editorconfig', allow_eol = (LF,), indent = 0) +retval += sanitycheck('.github/**/*.md', allow_eol = (LF,)) +retval += sanitycheck('.github/**/*.yml', allow_eol = (LF,), indent = 2) +retval += sanitycheck('.vscode/**/*.json', allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/Dockerfile', allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.cmd', allow_eol = (CRLF,), indent = 2) +retval += sanitycheck('**/*.config', allow_utf8 = True, allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.cs', allow_utf8 = True, allow_eol = (LF,)) +retval += sanitycheck('**/*.cshtml', allow_utf8 = True, allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.csproj', allow_utf8 = True, allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.htm', allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.html', allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.md', allow_eol = (LF,)) +retval += sanitycheck('**/*.proj', allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.props', allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.py', allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.ruleset', allow_utf8 = True, allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.sln', allow_utf8 = True, allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.targets', allow_eol = (LF,), indent = 2) +retval += sanitycheck('**/*.xml', allow_eol = (LF,), indent = 4) +retval += sanitycheck('**/*.yml', allow_eol = (LF,), indent = 2) + +sys.exit(retval)