prom3theu5 / aspirational-manifests

Handle deployments of .NET Aspire AppHost Projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dapr Components are currently breaking the build / generate process

paule96 opened this issue Β· comments

πŸ”₯ Bug Description

If you have in your aspire manifest a resource that uses Dapr you're will get the following exception:

Error executing action 'SubstituteValuesAspireManifestAction':
System.NotSupportedException: Runtime type 'Aspirate.Shared.Models.AspireManifests.Components.V0.Dapr.DaprComponentResource' is not supported by polymorphic type
'Aspirate.Shared.Models.AspireManifests.Resource'. Path: $.
     System.NotSupportedException: Runtime type 'Aspirate.Shared.Models.AspireManifests.Components.V0.Dapr.DaprComponentResource' is not supported by polymorphic type
     'Aspirate.Shared.Models.AspireManifests.Resource'.
       at void System.Text.Json.ThrowHelper.ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
       at bool System.Text.Json.Serialization.Metadata.PolymorphicTypeResolver.TryGetDerivedJsonTypeInfo(Type runtimeType, out JsonTypeInfo jsonTypeInfo, out object typeDiscriminator)
       at JsonConverter System.Text.Json.Serialization.JsonConverter.ResolvePolymorphicConverter(object value, JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options, ref WriteStack state)
       at bool System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
       at bool System.Text.Json.Serialization.Converters.DictionaryOfTKeyTValueConverter`3.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, ref WriteStack state)
       at bool System.Text.Json.Serialization.JsonDictionaryConverter`3.OnTryWrite(Utf8JsonWriter writer, TDictionary dictionary, JsonSerializerOptions options, ref WriteStack state)
       at bool System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
       at bool System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
  at void System.Text.Json.ThrowHelper.ThrowNotSupportedException(ref WriteStack state, NotSupportedException ex)
  at bool System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, in T value, JsonSerializerOptions options, ref WriteStack state)
  at void System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, in T rootValue, object rootValueBoxed)
  at string System.Text.Json.JsonSerializer.WriteString<TValue>(in TValue value, JsonTypeInfo<TValue> jsonTypeInfo)
  at string System.Text.Json.JsonSerializer.Serialize<TValue>(TValue value, JsonSerializerOptions options)
  at JsonNode Aspirate.Shared.Extensions.JsonExtensions.TryParseAsJsonNode<T>(T instance) in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Shared/Extensions/JsonExtensions.cs:42
  at void Aspirate.Processors.Transformation.ResourceExpressionProcessor.ProcessEvaluations(Dictionary<string, Resource> resources) in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Processors/Transformation/ResourceExpressionProcessor.cs:12
  at Task<bool> Aspirate.Commands.Actions.Manifests.SubstituteValuesAspireManifestAction.ExecuteAsync() in
     /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Commands/Actions/Manifests/SubstituteValuesAspireManifestAction.cs:9
  at async Task<int> Aspirate.Commands.Actions.ActionExecutor.ExecuteCommandsAsync() in /home/runner/work/aspirational-manifests/aspirational-manifests/src/Aspirate.Commands/Actions/ActionExecutor.cs:65

The problem seems to be that the DaprComponentResource is not listed in the attribute list here.

Is this by intention or was this just forgotten with the latest release?

πŸ” Steps to Reproduce the Bug

  1. Create new Aspire project
  2. Add to your API project as sidecar
  3. run aspirate.exe generate
  4. See error

🧯 Possible Solution

Add the attribute for DaprComponentResource to the Resource class

Sorry about that - it was overlooked, wasn't intentionally left out. Adding now, expect v0.6.4-preview in next ten mins with it added

Thank you for the fast fix πŸ‘