Skip to content

Commit

Permalink
Upgrade Quartz and some warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lahma committed Sep 8, 2024
1 parent 760a3e2 commit 0a35fcb
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 21 deletions.
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>

<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup>
<NoWarn>$(NoWarn);CS0162;CS1591</NoWarn>
<!-- IL trimming warnings -->
<NoWarn>$(NoWarn);IL2026;IL2046;IL2057;IL2067;IL2070;IL2072;IL2075;IL2087;IL2091</NoWarn>
</PropertyGroup>
<PropertyGroup>
<ElsaStudioVersion>3.3.0-preview.470</ElsaStudioVersion>
Expand Down
6 changes: 2 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@
<PackageVersion Include="Proto.Persistence.SqlServer" Version="1.6.0" />
<PackageVersion Include="Proto.Remote" Version="1.6.0" />
<PackageVersion Include="pythonnet" Version="3.0.3" />
<PackageVersion Include="Quartz" Version="3.11.0" />
<PackageVersion Include="Quartz.Extensions.DependencyInjection" Version="3.11.0" />
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.11.0" />
<PackageVersion Include="Quartz.Serialization.Json" Version="3.11.0" />
<PackageVersion Include="Quartz.Extensions.Hosting" Version="3.13.0" />
<PackageVersion Include="Quartz.Serialization.Json" Version="3.13.0" />
<PackageVersion Include="Refit" Version="7.1.2" />
<PackageVersion Include="Refit.HttpClientFactory" Version="7.0.0" />
<PackageVersion Include="Scrutor" Version="4.2.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ public static class PropertyBagExtensions
/// <param name="key">The key of the value to retrieve.</param>
/// <param name="defaultValue">A function that returns the default value to be returned if the key does not exist in the PropertyBag.</param>
/// <returns>The value associated with the key, or the default value if the key does not exist.</returns>
public static T TryGetValueOrDefault<T>(this PropertyBag propertyBag, string key, Func<T> defaultValue)
public static T? TryGetValueOrDefault<T>(this PropertyBag propertyBag, string key, Func<T> defaultValue)
{
if (!propertyBag.TryGetValue(key, out var value))
return defaultValue();

var json = value.ToString();

if (string.IsNullOrWhiteSpace(json))
return defaultValue();

return JsonSerializer.Deserialize<T>(json);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public class DefaultFormattersFeature(IModule module) : FeatureBase(module)
{
public override void Configure()
{
module.Services.AddSingleton<IFormatter, JsonFormatter>();
Module.Services.AddSingleton<IFormatter, JsonFormatter>();
}
}
2 changes: 1 addition & 1 deletion src/modules/Elsa.Common/Results/TenantResolutionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Elsa.Common.Results;
/// <summary>
/// Represents the result of a tenant resolution.
/// </summary>
/// <param name="Tenant">The resolved tenant.</param>
/// <param name="TenantId">The resolved tenant.</param>
public record TenantResolutionResult(string? TenantId)
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Elsa.Common/Serialization/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public string Serialize(object value)

/// <inheritdoc />
[RequiresUnreferencedCode("The type is not known at compile time.")]
public string Serialize(object value, Type type)
public string Serialize(object? value, Type type)
{
var options = GetOptions();
return JsonSerializer.Serialize(value, type, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public TDbContext CreateDbContext(string[] args)

ConfigureBuilder(builder, connectionString);

return (TDbContext)Activator.CreateInstance(typeof(TDbContext), builder.Options, serviceProvider);
return (TDbContext)Activator.CreateInstance(typeof(TDbContext), builder.Options, serviceProvider)!;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public override Migration CreateMigration(TypeInfo migrationClass, string active

if (hasCtorWithSchema && _context is IElsaDbContextSchema schema)
{
var instance = (Migration)Activator.CreateInstance(migrationClass.AsType(), schema);
var instance = (Migration)Activator.CreateInstance(migrationClass.AsType(), schema)!;
instance.ActiveProvider = activeProvider;
return instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Elsa.Extensions;
public static class ExpressionOptionsExtensions
{
/// <summary>
/// Register type <see cref="T"/> with the specified alias.
/// Register type <typeparamref name="T"/> with the specified alias.
/// </summary>
public static void AddTypeAlias<T>(this ExpressionOptions options) => options.RegisterTypeAlias(typeof(T), typeof(T).Name);
public static void AddTypeAlias<T>(this ExpressionOptions options, string alias) => options.RegisterTypeAlias(typeof(T), alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static IServiceCollection AddExpressionDescriptorProvider<T>(this IServic
}

/// <summary>
/// Register type <see cref="T"/> with the specified alias.
/// Register type <typeparamref name="T"/> with the specified alias.
/// </summary>
/// <param name="module">The module.</param>
/// <param name="alias">The alias.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Elsa.Expressions.Extensions;
public static class WellKnowTypeRegistryExtensions
{
/// <summary>
/// Register type <see cref="T"/> with the specified alias.
/// Register type <typeparamref name="T"/> with the specified alias.
/// </summary>
public static void RegisterType<T>(this IWellKnownTypeRegistry registry, string alias) => registry.RegisterType(typeof(T), alias);

Expand Down
1 change: 0 additions & 1 deletion src/modules/Elsa.Expressions/Models/Expression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public Expression(string type, object? value)
/// Creates an expression that represents a delegate.
/// </summary>
/// <param name="value">The delegate.</param>
/// <typeparam name="T">The return type of the delegate.</typeparam>
/// <returns>An expression that represents a delegate.</returns>
public static Expression DelegateExpression(Func<ExpressionExecutionContext, ValueTask<object?>> value) => new()
{
Expand Down
2 changes: 0 additions & 2 deletions src/modules/Elsa.Quartz/Elsa.Quartz.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Quartz" />
<PackageReference Include="Quartz.Extensions.DependencyInjection" />
<PackageReference Include="Quartz.Extensions.Hosting" />
</ItemGroup>

Expand Down
3 changes: 0 additions & 3 deletions src/modules/Elsa.Quartz/Features/QuartzFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public override void Apply()

private static void ConfigureQuartzInternal(IServiceCollectionQuartzConfigurator quartz, Action<IServiceCollectionQuartzConfigurator>? configureQuartz)
{
quartz.UseMicrosoftDependencyInjectionJobFactory();
quartz.UseSimpleTypeLoader();
quartz.UseInMemoryStore();
configureQuartz?.Invoke(quartz);
}
}
2 changes: 1 addition & 1 deletion src/modules/Elsa.Tenants/Extensions/ModuleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Elsa.Tenants.Extensions;
public static class ModuleExtensions
{
/// <summary>
/// Installs & configures the <see cref="TenantsFeature"/> feature.
/// Installs and configures the <see cref="TenantsFeature"/> feature.
/// </summary>
public static IModule UseTenants(this IModule module, Action<TenantsFeature>? configure = default)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ public async Task SetWorkflowGraphAsync(WorkflowGraph workflowGraph)
public Diff<Bookmark> BookmarksDiff => Diff.For(OriginalBookmarks, Bookmarks);

/// <summary>
/// A dictionary of inputs provided at the start of the current workflow execution.
/// A dictionary of inputs provided at the start of the current workflow execution.
/// </summary>
public IDictionary<string, object> Input { get; set; }

/// A dictionary of outputs provided by the current workflow execution.
Expand Down Expand Up @@ -398,6 +399,7 @@ internal void RemoveCompletionCallbacks(IEnumerable<ActivityCompletionCallbackEn

/// <summary>
/// Returns the <see cref="ActivityNode"/> with the specified activity ID from the workflow graph.
/// </summary>
public ActivityNode? FindNodeById(string nodeId) => NodeIdLookup.TryGetValue(nodeId, out var node) ? node : default;

/// Returns the <see cref="ActivityNode"/> with the specified hash of the activity node ID from the workflow graph.
Expand Down

0 comments on commit 0a35fcb

Please sign in to comment.