microsoft/aspire · error · InvalidOperationException
Resource view limit of
Error message
Resource view limit of {TelemetryRepositoryLimits.MaxResourceViewCount} reached. What it means
Each OtlpResource in the Dashboard caches a bounded number of distinct resource views (combinations of view properties) via TelemetryRepositoryLimits.MaxResourceViewCount. GetView throws this InvalidOperationException when a request for a new view variant arrives and the cache is already at that limit. This prevents unbounded memory growth if a resource accumulates endlessly many distinct property combinations.
Solutions
- Ensure resource attributes are stable for the process lifetime and don't include per-request or high-cardinality values.
- Reduce the variety of view property combinations requested for a single resource.
- Restart the Dashboard session to clear cached resource views if a run legitimately accumulated many views.
Example fix
// before: high-cardinality value in resource attributes
.AddTag("request.id", requestId)
// after: keep resource tags stable
.AddTag("service.instance.id", instanceId) Defensive patterns
Strategy: try-catch
Try / catch
try
{
var view = resource.GetView(properties);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Resource view limit"))
{
logger.LogWarning(ex, "Falling back to default resource view.");
view = resource.GetView(Array.Empty<KeyValuePair<string, string>>());
} Prevention
- Keep resource attributes fixed for the process lifetime.
- Avoid high-cardinality values (request ids, timestamps) in resource attributes.
- Limit the number of distinct view property combinations your tooling requests.
When it happens
Trigger: GetView on OtlpResource throws when _resourceViews.Count >= TelemetryRepositoryLimits.MaxResourceViewCount and a view with a previously unseen Properties combination is requested. Triggered during telemetry ingestion/UI lookup when many distinct attribute-subset views are derived for the same resource.
Common situations: Resources whose attributes churn constantly (e.g. per-request attributes leaking into resource attributes); dashboards or extensions requesting many different view property sets; high-cardinality resource attributes evolving over a long session.
Related errors
- Resource limit of reached. Resource ' ' will not be added.
- Scope limit of reached for . Scope ' ' will not be added.
- Resource view limit of
- Scope limit of reached. Scope ' ' will not be added.
- otel resource
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/88fa5c0e11c48a78.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Dashboard/Otlp/Model/OtlpResource.cs:88
}
internal OtlpResourceView GetViewFromProperties(KeyValuePair<string, string>[] properties)
{
return GetView(new OtlpResourceView(this, properties));
}
private OtlpResourceView GetView(OtlpResourceView view)
{
// Inefficient to create this to possibly throw it away.
if (_resourceViews.TryGetValue(view.Properties, out var resourceView))
{
return resourceView;
}
if (_resourceViews.Count >= TelemetryRepositoryLimits.MaxResourceViewCount)
{
throw new InvalidOperationException($"Resource view limit of {TelemetryRepositoryLimits.MaxResourceViewCount} reached.");
}
return _resourceViews.GetOrAdd(view.Properties, view);
}
internal void SetUninstrumentedPeer(bool uninstrumentedPeer)
{
// An app could initially be created for an uninstrumented peer and then telemetry is received from it.
// This method "upgrades" the resource to not be for an uninstrumented peer when appropriate.
if (UninstrumentedPeer && !uninstrumentedPeer)
{
UninstrumentedPeer = uninstrumentedPeer;
}
}
/// <summary>
/// Resource views are equal when all properties are equal.
/// </summary>View on GitHub (pinned to 25830f84bd)