sql-bi / DaxTemplate

Tabular and DAX template engine
MIT License
17 stars 4 forks source link

ArgumentException - column already exists in the collection #7

Closed albertospelta closed 2 years ago

albertospelta commented 2 years ago

Exception occurs when cloned columns are restored https://github.com/sql-bi/DaxTemplate/blob/fbc844b9cc154701cf1fc0d03d3615d260e97825/Dax.Template/Tables/TableTemplateBase.cs#L310

Message: Item 'Month' already exists in the collection. Exception type: System.ArgumentException

System.ArgumentException:
   at Microsoft.AnalysisServices.Tabular.NamedMetadataObjectCollection`2.ValidateCanAdd (Microsoft.AnalysisServices.Tabular, Version=19.36.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91)
   at Microsoft.AnalysisServices.Tabular.MetadataObjectCollection`2.Add (Microsoft.AnalysisServices.Tabular, Version=19.36.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91)
   at Dax.Template.Tables.TableTemplateBase+<>c__DisplayClass30_0.<AddColumns>b__1 (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at System.Collections.Generic.List`1.ForEach (System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Dax.Template.Tables.TableTemplateBase.AddColumns (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Tables.TableTemplateBase.ApplyTemplate (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Tables.Dates.BaseDateTemplate`1.ApplyTemplate (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Tables.TableTemplateBase.ApplyTemplate (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Engine.CreateDateTable (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Engine+<>c__DisplayClass5_0.<ApplyTemplates>g__ApplyCustomDateTable|3 (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at Dax.Template.Engine+<>c__DisplayClass5_0.<ApplyTemplates>b__0 (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)
   at System.Collections.Generic.List`1.ForEach (System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at Dax.Template.Engine.ApplyTemplates (Dax.Template, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null)