Enable nullable annotations for Volo.Abp.BackgroundJobs.Abstractions

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

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

@ -54,7 +54,7 @@ public class BackgroundJobExecuter : IBackgroundJobExecuter, ITransientDependenc
{
if (jobExecuteMethod.Name == nameof(IAsyncBackgroundJob<object>.ExecuteAsync))
{
await ((Task)jobExecuteMethod.Invoke(job, new[] { context.JobArgs }));
await ((Task)jobExecuteMethod.Invoke(job, new[] { context.JobArgs })!);
}
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)
{
JobType = context.JobType.AssemblyQualifiedName,
JobType = context.JobType.AssemblyQualifiedName!,
JobArgs = context.JobArgs
};
}

@ -6,9 +6,9 @@ namespace Volo.Abp.BackgroundJobs;
[Serializable]
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()
{

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

Loading…
Cancel
Save