Enable nullable annotations for Volo.Abp.BackgroundJobs.Abstractions

pull/17109/head
liangshiwei 2 years ago
parent cf7b4171bb
commit 9b6c545bd7

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.BackgroundJobs.Abstractions</AssemblyName> <AssemblyName>Volo.Abp.BackgroundJobs.Abstractions</AssemblyName>
<PackageId>Volo.Abp.BackgroundJobs.Abstractions</PackageId> <PackageId>Volo.Abp.BackgroundJobs.Abstractions</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

@ -54,7 +54,7 @@ public class BackgroundJobExecuter : IBackgroundJobExecuter, ITransientDependenc
{ {
if (jobExecuteMethod.Name == nameof(IAsyncBackgroundJob<object>.ExecuteAsync)) if (jobExecuteMethod.Name == nameof(IAsyncBackgroundJob<object>.ExecuteAsync))
{ {
await ((Task)jobExecuteMethod.Invoke(job, new[] { context.JobArgs })); await ((Task)jobExecuteMethod.Invoke(job, new[] { context.JobArgs })!);
} }
else else
{ {
@ -74,7 +74,7 @@ public class BackgroundJobExecuter : IBackgroundJobExecuter, ITransientDependenc
throw new BackgroundJobExecutionException("A background job execution is failed. See inner exception for details.", ex) throw new BackgroundJobExecutionException("A background job execution is failed. See inner exception for details.", ex)
{ {
JobType = context.JobType.AssemblyQualifiedName, JobType = context.JobType.AssemblyQualifiedName!,
JobArgs = context.JobArgs JobArgs = context.JobArgs
}; };
} }

@ -6,9 +6,9 @@ namespace Volo.Abp.BackgroundJobs;
[Serializable] [Serializable]
public class BackgroundJobExecutionException : AbpException public class BackgroundJobExecutionException : AbpException
{ {
public string JobType { get; set; } public string JobType { get; set; } = default!;
public object JobArgs { get; set; } public object JobArgs { get; set; } = default!;
public BackgroundJobExecutionException() public BackgroundJobExecutionException()
{ {

@ -22,11 +22,11 @@ public class BackgroundJobNameAttribute : Attribute, IBackgroundJobNameProvider
{ {
Check.NotNull(jobArgsType, nameof(jobArgsType)); Check.NotNull(jobArgsType, nameof(jobArgsType));
return jobArgsType return (jobArgsType
.GetCustomAttributes(true) .GetCustomAttributes(true)
.OfType<IBackgroundJobNameProvider>() .OfType<IBackgroundJobNameProvider>()
.FirstOrDefault() .FirstOrDefault()
?.Name ?.Name
?? jobArgsType.FullName; ?? jobArgsType.FullName)!;
} }
} }

Loading…
Cancel
Save