いずれかのカタログ エンティティ(「SellableItem」、「Category」あるいは「Catalog」)のコンポーネントのコレクションが、シリアライズ中またはレスポンス ボディへのカタログ エンティティの書き込み中に変更されると、問題が発生する可能性があります。
ODataプレゼンテーションでカタログ エンティティの列挙が発生すると、コンポーネントのコレクションが各イテレーションごとに比較されます。そして、現在のバージョンと以前のバージョンが等しくないと、「collection was modified」例外がスローされます。
問題が発生した場合、Commerceのログ ファイルに以下のようなスタック トレースが出力されます:
ERROR Connection id ""0HLM9N12Q3EI6"", Request id ""0HLM9N12Q3EI6:00000003"": An unhandled exception was thrown by the application. System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext) at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteExpandedNavigationProperty(KeyValuePair`2 navigationPropertyToExpand, EntityInstanceContext entityInstanceContext, ODataWriter writer) at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteExpandedNavigationProperties(IDictionary`2 navigationPropertiesToExpand, EntityInstanceContext entityInstanceContext, ODataWriter writer) at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext) at Microsoft.AspNetCore.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext) at Microsoft.AspNetCore.OData.Formatter.ODataOutputFormatter.WriteResponseBody(OutputFormatterWriteContext context) at System.Threading.Tasks.Task.Execute()
この問題を解決するには、次のパッチをダウンロードしてインストールしてください。
Sitecore XC 9.0.3向け: https://github.com/sitecoresupport/Sitecore.Support.389445/releases
インストール手順については、readmeファイルをご参照ください。