Skip to content

Register ITargetScalerErrorRepository in AddCommonScaleServices and make public#3204

Merged
alrod merged 1 commit into
devfrom
users/alrod/fix-targetscaler-registration
May 19, 2026
Merged

Register ITargetScalerErrorRepository in AddCommonScaleServices and make public#3204
alrod merged 1 commit into
devfrom
users/alrod/fix-targetscaler-registration

Conversation

@alrod

@alrod alrod commented May 15, 2026

Copy link
Copy Markdown
Member

Summary

Fix missing DI registration in AddCommonScaleServices and make ITargetScalerErrorRepository public so external consumers can implement it directly.

Problem

SDK 3.0.46 (PR #3191) introduced ITargetScalerErrorRepository as a required dependency of ScaleManager. However, the TryAddSingleton registration was only added in AddWebJobs(). Callers using ConfigureWebJobsScale (e.g. Scale Controller) go through AddWebJobsScale -> AddCommonScaleServices, which was missing this registration, causing:

Unable to resolve service for type 'ITargetScalerErrorRepository'
while attempting to activate 'ScaleManager'

Making the interface public allows Scale Controller to provide its own in-memory implementation that tracks errored target scalers within the process lifetime, so broken scalers fall back to incremental monitoring without retrying every cycle.

Changes

  • AddCommonScaleServices: Add TryAddSingleton for ITargetScalerErrorRepository so all scale host scenarios have a safe default
  • ITargetScalerErrorRepository: Change from internal to public so external consumers can implement it directly
  • PublicSurfaceTests: Add ITargetScalerErrorRepository to expected public types

Testing

  • All existing tests pass including PublicSurfaceTests

@alrod alrod force-pushed the users/alrod/fix-targetscaler-registration branch 2 times, most recently from 163e603 to 90bf7aa Compare May 15, 2026 21:51
…ake public

ScaleManager now requires ITargetScalerErrorRepository (added in 3.0.46),
but the registration was only added in AddWebJobs(). Callers using
ConfigureWebJobsScale (e.g. Scale Controller) go through AddWebJobsScale
-> AddCommonScaleServices, which was missing this registration, causing:

  Unable to resolve service for type
  'ITargetScalerErrorRepository' while attempting to activate
  'ScaleManager'

Changes:
- Add TryAddSingleton<ITargetScalerErrorRepository, NullTargetScalerErrorRepository>
  to AddCommonScaleServices so all scale host scenarios work.
- Make ITargetScalerErrorRepository and NullTargetScalerErrorRepository public
  so external consumers (Scale Controller) can implement the interface directly
  without reflection-based DispatchProxy workarounds.

Co-authored-by: Dobby <dobby@microsoft.com>
@alrod alrod force-pushed the users/alrod/fix-targetscaler-registration branch from 90bf7aa to a5c95d5 Compare May 18, 2026 17:51
@alrod alrod merged commit 7c91ac2 into dev May 19, 2026
5 checks passed
@alrod alrod deleted the users/alrod/fix-targetscaler-registration branch May 19, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants