Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="9.0.4"/>
<PackageReference Include="ReportGenerator" Version="5.5.0"/>
<PackageReference Include="ReportGenerator" Version="5.5.1" />
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.0" PrivateAssets="all"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="10.0.1" />
<PackageReference Include="Microsoft.DotNet.HotReload.WebAssembly.Browser" Version="10.0.101" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/NetSampleApp/NetSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions samples/ProcessUtilsSampleApp/ProcessUtilsSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/WebApiSampleApp/WebApiSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.1"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@


<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0"/>
<PackageReference Include="Microsoft.JSInterop" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.1" />
<PackageReference Include="Microsoft.JSInterop" Version="10.0.1" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
<PackageReference Include="Spectre.Console" Version="0.54.0"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using CreativeCoders.Cli.Core;
using CreativeCoders.Cli.Hosting.Commands;
Expand Down Expand Up @@ -86,6 +87,7 @@ public ICliHostBuilder SkipScanEntryAssembly(bool skipScanEntryAssembly = true)
return this;
}

[SuppressMessage("Performance", "CA1859:Use concrete types when possible for improved performance")]
private IServiceProvider BuildServiceProvider()
{
var services = new ServiceCollection();
Expand Down
3 changes: 3 additions & 0 deletions source/Cli/CreativeCoders.Cli.Hosting/ICliHost.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using JetBrains.Annotations;

namespace CreativeCoders.Cli.Hosting;

/// <summary>
/// Represents a Command Line Interface (CLI) host that provides functionality to execute
/// commands and handle related tasks.
/// </summary>
[PublicAPI]
public interface ICliHost
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions source/Core/CreativeCoders.Core/CreativeCoders.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0"/>
<PackageReference Include="System.IO.Abstractions" Version="22.0.16"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.1" />
<PackageReference Include="System.IO.Abstractions" Version="22.1.0" />
</ItemGroup>

</Project>
91 changes: 42 additions & 49 deletions source/Core/CreativeCoders.Core/Ensure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace CreativeCoders.Core;
[PublicAPI]
public static class Ensure
{
private const string UnkownParamName = "[unknown]";

///-------------------------------------------------------------------------------------------------
/// <summary> Ensures that <paramref name="value"/> is not null. </summary>
///
Expand All @@ -32,21 +34,16 @@ public static class Ensure
[ContractAnnotation("value: null => halt; value: notnull => notnull")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[return: System.Diagnostics.CodeAnalysis.NotNull]
public static T NotNull<T>([System.Diagnostics.CodeAnalysis.NotNull][NoEnumeration] T? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
public static T NotNull<T>([System.Diagnostics.CodeAnalysis.NotNull] [NoEnumeration] T? value,
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
if (value is null)
{
throw new ArgumentNullException(paramName);
}

return value;
return value ?? throw new ArgumentNullException(paramName);
}

[ContractAnnotation("value: null => halt")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsNotNull([System.Diagnostics.CodeAnalysis.NotNull][NoEnumeration] object? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
public static void IsNotNull([System.Diagnostics.CodeAnalysis.NotNull] [NoEnumeration] object? value,
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
if (value is null)
{
Expand All @@ -64,7 +61,7 @@ public static void IsNotNull([System.Diagnostics.CodeAnalysis.NotNull][NoEnumera
///-------------------------------------------------------------------------------------------------
[ContractAnnotation("halt <= value: null")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsNotNull<T>([System.Diagnostics.CodeAnalysis.NotNull][NoEnumeration] object? value,
public static void IsNotNull<T>([System.Diagnostics.CodeAnalysis.NotNull] [NoEnumeration] object? value,
Func<T> createException) where T : Exception
{
if (value == null)
Expand All @@ -87,14 +84,11 @@ public static void IsNotNull<T>([System.Diagnostics.CodeAnalysis.NotNull][NoEnum
[ContractAnnotation("halt <= value: null; value: notnull => notnull")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string IsNotNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNull] string? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Must not be null or empty", paramName);
}

return value;
return string.IsNullOrEmpty(value)
? throw new ArgumentException("Must not be null or empty", paramName)
: value;
}

///-------------------------------------------------------------------------------------------------
Expand All @@ -110,7 +104,7 @@ public static string IsNotNullOrEmpty([System.Diagnostics.CodeAnalysis.NotNull]
[ContractAnnotation("halt <= value: null")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IsNotNullOrEmpty<T>(IEnumerable<T?>? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
if (value == null || !value.Any())
{
Expand All @@ -132,14 +126,11 @@ public static void IsNotNullOrEmpty<T>(IEnumerable<T?>? value,
[ContractAnnotation("halt <= value: null; value: notnull => notnull")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string IsNotNullOrWhitespace(string? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Must not be null or whitespace", paramName);
}

return value;
return string.IsNullOrWhiteSpace(value)
? throw new ArgumentException("Must not be null or whitespace", paramName)
: value;
}

/// -------------------------------------------------------------------------------------------------
Expand All @@ -152,7 +143,7 @@ public static string IsNotNullOrWhitespace(string? value,
/// <param name="paramName"> Name of the <paramref name="fileName"/> parameter. </param>
/// -------------------------------------------------------------------------------------------------
public static void FileExists(string? fileName,
[CallerArgumentExpression("fileName")] string paramName = "[unknown]")
[CallerArgumentExpression("fileName")] string paramName = UnkownParamName)
{
if (!FileSys.File.Exists(fileName))
{
Expand All @@ -173,11 +164,13 @@ public static void FileExists(string? fileName,
/// <param name="paramName"> Name of the <paramref name="directoryName"/> parameter. </param>
///-------------------------------------------------------------------------------------------------
public static void DirectoryExists(string? directoryName,
[CallerArgumentExpression("directoryName")] string paramName = "[unknown]")
[CallerArgumentExpression("directoryName")]
string paramName = UnkownParamName)
{
if (!FileSys.Directory.Exists(directoryName))
{
throw new DirectoryNotFoundException($"Directory parameter '{paramName}' not found: '{directoryName}'");
throw new DirectoryNotFoundException(
$"Directory parameter '{paramName}' not found: '{directoryName}'");
}
}

Expand All @@ -191,46 +184,46 @@ public static void DirectoryExists(string? directoryName,
///-------------------------------------------------------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void GuidIsNotEmpty(Guid guid,
[CallerArgumentExpression("guid")] string paramName = "[unknown]")
[CallerArgumentExpression("guid")] string paramName = UnkownParamName)
{
if (guid.Equals(Guid.Empty))
{
throw new ArgumentException("Guid cannot be empty", paramName);
}
}

///-------------------------------------------------------------------------------------------------
/// <summary> Ensures that <paramref name="condition"/> is true. </summary>
///
/// -------------------------------------------------------------------------------------------------
/// <summary> Ensures that <paramref name="condition"/> is true. </summary>
/// <param name="condition"> The condition that gets checked. </param>
/// <param name="paramName"> Name of the parameter that gets checked. </param>
/// <param name="message"> The message for the exception. </param>
///-------------------------------------------------------------------------------------------------
/// <param name="paramName"> Name of the parameter that gets checked. </param>
/// -------------------------------------------------------------------------------------------------
[ContractAnnotation("halt <= condition: false")]
public static void That(bool condition,
[CallerArgumentExpression("condition")] string paramName = "[unknown]",
string message = "Assertion failed")
string message = "Assertion failed",
[CallerArgumentExpression("condition")]
string paramName = UnkownParamName)
{
if (!condition)
{
throw new ArgumentException(message, paramName);
}
}

///-------------------------------------------------------------------------------------------------
/// <summary> Ensures that a index meets a condition. </summary>
///
/// <exception cref="ArgumentOutOfRangeException"> Thrown when <paramref name="condition"/> is
/// false, cause index not meets requirements. </exception>
/// -------------------------------------------------------------------------------------------------
/// <summary> Ensures that a index meets a condition. </summary>
///
/// <exception cref="ArgumentOutOfRangeException"> Thrown when <paramref name="condition"/> is
/// false, cause index not meets requirements. </exception>
/// <param name="condition"> The condition that gets checked. </param>
/// <param name="paramName"> Name of the parameter that gets checked. </param>
/// <param name="message"> The message for the exception. </param>
///-------------------------------------------------------------------------------------------------
/// <param name="paramName"> Name of the parameter that gets checked. </param>
/// -------------------------------------------------------------------------------------------------
[ContractAnnotation("halt <= condition: false")]
public static void ThatRange(bool condition,
[CallerArgumentExpression("condition")] string paramName = "[unknown]",
string message = "Assertion failed")
string message = "Assertion failed",
[CallerArgumentExpression("condition")]
string paramName = UnkownParamName)
{
if (!condition)
{
Expand All @@ -253,7 +246,7 @@ public static void ThatRange(bool condition,
///-------------------------------------------------------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IndexIsInRange(int index, int startIndex, int endIndex,
[CallerArgumentExpression("index")] string paramName = "[unknown]")
[CallerArgumentExpression("index")] string paramName = UnkownParamName)
{
if (index < startIndex || index > endIndex)
{
Expand All @@ -276,7 +269,7 @@ public static void IndexIsInRange(int index, int startIndex, int endIndex,
///-------------------------------------------------------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void IndexIsInRange(int index, int collectionLength,
[CallerArgumentExpression("index")] string paramName = "[unknown]")
[CallerArgumentExpression("index")] string paramName = UnkownParamName)
{
if (index < 0 || index >= collectionLength)
{
Expand All @@ -296,7 +289,7 @@ public static void IndexIsInRange(int index, int collectionLength,
///-------------------------------------------------------------------------------------------------
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Argument<T?> Argument<T>(T? value,
[CallerArgumentExpression("value")] string paramName = "[unknown]")
[CallerArgumentExpression("value")] string paramName = UnkownParamName)
{
return new Argument<T?>(value, paramName);
}
Expand Down
4 changes: 2 additions & 2 deletions source/Core/CreativeCoders.Core/Text/TextSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class TextSpan
///-------------------------------------------------------------------------------------------------
public TextSpan(int start, int length)
{
Ensure.That(start >= 0, nameof(start), "Start must not be less 0");
Ensure.That(length >= 0, nameof(length), "Length must not be less 0");
Ensure.That(start >= 0, "Start must not be less 0");
Ensure.That(length >= 0, "Length must not be less 0");

Start = start;
Length = length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading
Loading