Tinkoff / Horarium

Horarium is the .Net library to manage background jobs
Apache License 2.0
56 stars 12 forks source link

JobType for generic jobs generated with assembly version #60

Open dopusteam opened 1 year ago

dopusteam commented 1 year ago

There is such code in JobDb

jobDb.JobType = jobMetadata.JobType.AssemblyQualifiedNameWithoutVersion();

where AssemblyQualifiedNameWithoutVersion looks like

public static string AssemblyQualifiedNameWithoutVersion(this Type type) => type.FullName + ", " + type.GetTypeInfo().Assembly.GetName().Name;

When we use generic job, we get name with version because type.FullName returns something like

GenericJob`1[[GenericType, MyAssembly, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null]]

and result JobType for generic type looks like

GenericJob`1[[GenericType, MyAssembly, Version=0.0.0.1, Culture=neutral, PublicKeyToken=null]], MyAssembly

As a result, after updating assembly version horarium will not be able to handle jobs created in previous version.