Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No instance of ITargetingContextAccessor is available for variant assignment. #425

Closed
joacar opened this issue Apr 11, 2024 · 6 comments
Closed

Comments

@joacar
Copy link

joacar commented Apr 11, 2024

Hi

In my production logs I see this warning message No instance of ITargetingContextAccessor is available for variant assignment. from namespace Microsoft.FeatureManagement.FeatureManager.

NuGet Microsoft.FeatureManagment.AspNetCore::3.2.0

// From JetBrains decompiled assembly
[assembly: Extension]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Microsoft.FeatureManagement.AspNetCore provides a way to develop and expose application functionality based on features. Many applications have special requirements when a new feature is developed such as when the feature should be enabled and under what conditions. This library provides a way to define these relationships, and also integrates into common ASP.NET Core code patterns to make exposing these features possible.")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyInformationalVersion("4.0.0-preview2+5c2af2c403c2f1098102a797abb83805379b7652")]
[assembly: AssemblyProduct("Microsoft.FeatureManagement.AspNetCore")]
[assembly: AssemblyTitle("Microsoft.FeatureManagement.AspNetCore")]
[assembly: AssemblyVersion("4.0.0.0")]

dotnet

>dotnet --version
8.0.101
>dotnet --list-sdks
7.0.305 [/usr/local/share/dotnet/sdk]
8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]
8.0.101 [/usr/local/share/dotnet/sdk]
@rossgrambo
Copy link
Contributor

Hello @joacar!

That error is only possible in 4.0.0-preview and above. I see 4.0.0-preview2 in your log which sounds like your app might have had the FeatureManagement package be updated to the preview version. If this wasn't intentional, you may want to go back to stable 3.2.0.

That warning means there was no ITargetingContextAccessor defined. This means TargetingContext can't be automatically determined for the given user. This only matters if you're using TargetingFilters or the preview feature Variants.

Either way, us logging this warning here is misleading, it should happen only during variant assignment. So thank you for reporting it!

@joacar
Copy link
Author

joacar commented Apr 11, 2024

Thanks I'll check the version of the NuGet package so it's really 3.2.0

@zhiyuanliang-ms
Copy link
Contributor

Hi, @joacar Did you confirm that the problem was caused by the package version?

@joacar
Copy link
Author

joacar commented Apr 22, 2024

Sorry I forgot to reply! I'm quite sure I haven't seen it, let me verify later this evening.

Cheers

@joacar
Copy link
Author

joacar commented Apr 23, 2024

Problem resolved!

@zhiyuanliang-ms
Copy link
Contributor

@joacar Glad to hear that. I will close this issue.

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

No branches or pull requests

3 participants