Azure-Functions
Azure-Functions copied to clipboard
[BUG] Type registration intermittent failures during function app startup.
Issue Transfer
This issue has been transferred from the Azure SDK for .NET repository, #26736.
Please be aware that @Prinsn is the author of the original issue and include them for any questions or replies.
Details
Describe the bug
This hadn't been seen for a few days and then it started happening again
[2022-02-01T21:58:18.900Z] A host error has occurred during startup operation 'dcac9d8d-921d-4217-93c6-f2685175de91'.
[2022-02-01T21:58:18.902Z] Microsoft.Azure.WebJobs.Script.WebHost: Registering implementation type *.ContributionPartnerPreprocessor is not assignable to service type *.IEFPreprocesserHandler.
public class ContributionPartnerPreprocessor : EFPreprocesserHandler<ContributionPartner>
...
public abstract class EFPreprocesserHandler<TEntity> : IEFPreprocesserHandler
where TEntity : class
The specific type that will be in error is inconsistent, but it follows a log of all other IEFPreprocesserHandler implementing types registering successfully with no issue.
I thought it was related to other issues that I had since fixed, but it was consistently happening before, did not happen at all, and is happening consistently now.
Expected behavior
Should fail for all similar types or it should not fail at all because it has no unique quality to fail on or it should give better diagnostic information as to why it uniquely failed when it is affirmatively an implementing type
Actual behavior
Entirely unclear what is happening because this is being read from console log output from the service app during startup.
Somewhere in here (as it did not happen on an addition run, and the failing case was verified successfully registered in the logs)
[2022-02-01T22:10:36.878Z] IEFPreprocesserHandler: Implementation: IncomeLinePeriodPreprocessor, Lifetime: Scoped
[2022-02-01T22:07:54.842Z] IEFPreprocesserService: Implementation: EFPreprocesserService, Lifetime: Transient
[2022-02-01T22:07:54.849Z] Microsoft.EntityFrameworkCore.DbContextOptions`1[[DbContext, Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]: Factory, Lifetime: Scoped
[2022-02-01T22:07:54.850Z] Microsoft.EntityFrameworkCore.DbContextOptions: Factory, Lifetime: Scoped
[2022-02-01T22:07:54.852Z] DbContext: Implementation: DbContext, Lifetime: Transient
[2022-02-01T22:07:54.854Z] Microsoft.Extensions.Options.IOptionsChangeTokenSource`1[[Helpers.Classes.AppSettings, Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]: Instance: Microsoft.Extensions.Options.ConfigurationChangeTokenSource`1[[Helpers.Classes.AppSettings, Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Lifetime: Singleton
[2022-02-01T22:07:54.855Z] Microsoft.Extensions.Options.IConfigureOptions`1[[Helpers.Classes.AppSettings, Bdo.Pcaso.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]: Instance: Microsoft.Extensions.Options.NamedConfigureFromConfigurationOptions`1[[Helpers.Classes.AppSettings, Bdo.Pcaso.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], Lifetime: Singleton
[2022-02-01T22:07:54.857Z] Microsoft.Extensions.Configuration.IConfiguration: Instance: Microsoft.Extensions.Configuration.ConfigurationRoot, Lifetime: Singleton
[2022-02-01T22:07:54.859Z] Services registered by external startup type Microsoft.Azure.WebJobs.ServiceBus.ServiceBusWebJobsStartup:
[2022-02-01T22:07:54.865Z] Microsoft.Extensions.Options.IConfigureOptions`1[[Microsoft.Azure.WebJobs.ServiceBus.ServiceBusOptions, Microsoft.Azure.WebJobs.Extensions.ServiceBus, Version=5.2.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8]]: Factory, Lifetime: Singleton
Reproduction Steps
I cannot even begin to formulate reproduction steps for this short of deconstructing our app.
No changes to any settings, startup, or Azure related infrastructural bindings were made between the instances of no failures into instances of returning intermittent failure.
Environment
.NET 6 Visual Studio 2022
Supplementing with comment added on original item:
Clean rebuild seems to have fixed this for the time being, so I don't know if there's just some big goof with function console app local startup and teardowns that leave some build artifacts that lead to issues?
The cleaning methodology does not appear to work consistently
Hi @Prinsn , Thank you for your feedback! We will check for the possibilities internally and update you with the findings.