microsoft/aspire · error
ManagedClusterProperties.IngressProfile was null even after…
Error message
ManagedClusterProperties.IngressProfile was null even after assigning IngressWebAppRouting; the Azure.Provisioning lazy-initialization behavior may have changed.
What it means
AksPreviewIngressProfileInjector uses reflection to reach the internal ManagedClusterProperties.IngressProfile object on a ContainerServiceManagedCluster. It first assigns IngressWebAppRouting, which is expected to lazily create the internal IngressProfile instance. This error means that even after that assignment, the reflected IngressProfile property returned null, i.e. the Azure.Provisioning lazy-initialization contract this injector relies on no longer holds.
Solutions
- Check the installed Azure.Provisioning.ContainerService version and pin the version known to work (1.0.0-beta.6) in Directory.Packages.props
- Inspect the new SDK: if ManagedClusterIngressProfile is now public, replace the reflection injector with the standard public-subclass pattern and delete AksPreviewIngressProfileInjector (tracked in aspire issue 17060)
- If the type is still internal, find the new lazy-init trigger property (e.g. a different ingress sub-property) and assign that before calling GetIngressProfileInstance
- Follow/escalate upstream azure-sdk-for-net issue 59225 for the public API fix
Example fix
// before (reflection bootstrap) aks.IngressWebAppRouting = new ManagedClusterIngressProfileWebAppRouting(); var ingressProfile = GetIngressProfileInstance(aks); // after (once ManagedClusterIngressProfile is public) aks.IngressProfile.GatewayAPI.Installation = ... // i.e. delete AksPreviewIngressProfileInjector and use the public typed surface
Defensive patterns
Strategy: try-catch
Validate before calling
var propsProp = typeof(ContainerServiceManagedCluster).GetProperty("Properties", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
var ipProp = propsProp?.GetValue(aks) is { } p ? p.GetType().GetProperty("IngressProfile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) : null;
bool surfaceIntact = ipProp is not null; Try / catch
try
{
AksPreviewIngressProfileInjector.Inject(aks, gatewayApi: true, applicationLoadBalancer: false);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("IngressProfile"))
{
// Azure.Provisioning surface changed; fall back to non-preview configuration or pin the SDK version.
} Prevention
- Pin Azure.Provisioning.ContainerService to a tested version in Directory.Packages.props
- Run publish-mode Bicep generation tests whenever upgrading Azure.Provisioning.* packages
- Track aspire issue 17060 and azure-sdk-for-net issue 59225 for the public API replacement
When it happens
Trigger: Calling AksPreviewIngressProfileInjector.Inject (directly or via AKS gateway-API / application-load-balancer configuration) with a Azure.Provisioning.ContainerService version where setting ContainerServiceManagedCluster.IngressWebAppRouting no longer eagerly initializes ManagedClusterProperties.IngressProfile, or where the Properties/IngressProfile property layout changed so the reflected getter returns null.
Common situations: Upgrading the Azure.Provisioning.ContainerService NuGet package (currently 1.0.0-beta.6) to a newer beta or GA version; the upstream SDK was regenerated and the internal IngressProfile is now built at emit time rather than at setter time; pinning a different transient version via NuGet resolution.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- ContainerServiceManagedCluster.Properties not found via…
- ContainerServiceManagedCluster.Properties returned null.
- Expected IngressProfile to be a…
- ManagedClusterProperties.IngressProfile not found via…
- ProvisionableConstruct.DefineProperty
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/cf6eef29d143bf29.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Azure.Kubernetes/AksPreviewIngressProfileInjector.cs:174
}
private static object GetIngressProfileInstance(ContainerServiceManagedCluster aks)
{
// ContainerServiceManagedCluster.Properties is internal and exposes the
// ManagedClusterProperties complex object that owns IngressProfile (also internal).
var clusterPropsProp = typeof(ContainerServiceManagedCluster).GetProperty(
"Properties",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
?? throw new InvalidOperationException("ContainerServiceManagedCluster.Properties not found via reflection. The Azure.Provisioning surface may have changed; review AksPreviewIngressProfileInjector.");
var clusterProps = clusterPropsProp.GetValue(aks)
?? throw new InvalidOperationException("ContainerServiceManagedCluster.Properties returned null.");
var ipProp = clusterProps.GetType().GetProperty(
"IngressProfile",
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
?? throw new InvalidOperationException("ManagedClusterProperties.IngressProfile not found via reflection. The Azure.Provisioning surface may have changed; review AksPreviewIngressProfileInjector.");
var ipInstance = ipProp.GetValue(clusterProps)
?? throw new InvalidOperationException("ManagedClusterProperties.IngressProfile was null even after assigning IngressWebAppRouting; the Azure.Provisioning lazy-initialization behavior may have changed.");
if (ipInstance.GetType().FullName != IngressProfileTypeFullName)
{
throw new InvalidOperationException($"Expected IngressProfile to be a {IngressProfileTypeFullName} but found {ipInstance.GetType().FullName}.");
}
return ipInstance;
}
}
View on GitHub (pinned to 25830f84bd)