You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found two STJ problems with sitemap import & export. Both are related to polymorphic deserialization so it's the same bug.
If you try to export a new site map, the sitemap source will only contain the Id property, all other details are lost. It seems like the object is serialized as just SitemapSource instead of the derived type ContentTypesSitemapSource. See in the repro below.
When the site tries to parse a recipe from OC 1.8 containing the "Sitemaps" step, it throws the following, even before the recipe is executed. You can find the example error and the JSON that causes it below:
Orchard Core version
The latest main branch and 2.0.0-preview-18268 Cloudsmith package.
To Reproduce
Steps to reproduce the export error:
Create a site (example using Blog recipe).
Enable the "Sitemaps" feature.
Go to Admin > Configuration > SEO > Sitemaps.
Add a sitemap and a "Sitemap Content Types" source (I unchecked "Index All Content Types" and picked just Page and BlogPost).
Go to Admin > Configuration > Import/Export > Deployment Plans.
Create a deployment plan and add the "All Sitemaps" step.
Execute the deployment and open the resulting JSON.
Observe, that the SitemapSources is missing all details (expected something similar to the JSON in the logs section instead):
Go to Admin > Configuration > Import/Export > JSON Import
Paste the freshly exported site map.
Observe the error message Unexpected error occurred while executing the 'Sitemaps' step.
Observe the error in the log: Unable to import a recipe from JSON input. OrchardCore.Recipes.Models.RecipeExecutionException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'OrchardCore.Sitemaps.Models.SitemapType'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
Expected behavior
If possible, import from OC 1.x recipe should work. If that's not feasible, a note should be added into the release notes breaking changes section.
Export should include all
Logs and screenshots
If applicable, add log files, browser console logs, and screenshots (or screen recording videos) to help explain your problem.
This is example sitemap recipe from OC 1.8 that used to work:
2024-07-12 16:21:28.3105|test|00-6c4d175cf6fcafcbc633522a4d8c5e63-82c762aa10e7f9c7-00||OrchardCore.Setup.Services.SetupService|ERROR|Unable to import a recipe during setup. OrchardCore.Recipes.Models.RecipeExecutionException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'OrchardCore.Sitemaps.Models.SitemapType'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'OrchardCore.Sitemaps.Models.SitemapType'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
---> System.NotSupportedException: Deserialization of types without a parameterless constructor, a singular parameterized constructor, or a parameterized constructor annotated with 'JsonConstructorAttribute' is not supported. Type 'OrchardCore.Sitemaps.Models.SitemapType'.
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ThrowNotSupportedException(ReadStack& state, Utf8JsonReader& reader, NotSupportedException ex)
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_DeserializeNoConstructor(Type type, Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromNode[TValue](JsonNode node, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](JsonNode node, JsonSerializerOptions options)
at System.Text.Json.Nodes.JNode.ToObject[T](JsonNode jsonNode, JsonSerializerOptions options)
at OrchardCore.Sitemaps.Recipes.SitemapsStep.ExecuteAsync(RecipeExecutionContext context)
at OrchardCore.Recipes.Services.RecipeExecutor.<>c__DisplayClass8_0.<<ExecuteStepAsync>b__0>d.MoveNext()
The text was updated successfully, but these errors were encountered:
We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).
This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.
Describe the bug
I've found two STJ problems with sitemap import & export. Both are related to polymorphic deserialization so it's the same bug.
Id
property, all other details are lost. It seems like the object is serialized as justSitemapSource
instead of the derived typeContentTypesSitemapSource
. See in the repro below."Sitemaps"
step, it throws the following, even before the recipe is executed. You can find the example error and the JSON that causes it below:Orchard Core version
The latest
main
branch and 2.0.0-preview-18268 Cloudsmith package.To Reproduce
Steps to reproduce the export error:
SitemapSources
is missing all details (expected something similar to the JSON in the logs section instead):Expected behavior
If possible, import from OC 1.x recipe should work. If that's not feasible, a note should be added into the release notes breaking changes section.
Export should include all
Logs and screenshots
If applicable, add log files, browser console logs, and screenshots (or screen recording videos) to help explain your problem.
This is example sitemap recipe from OC 1.8 that used to work:
This is the error log that shows up now:
The text was updated successfully, but these errors were encountered: