Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Postby TaterJuice » Thu Jun 27, 2019 9:06 am

I've just upgraded an existing app to 1.2 (It was in production and working on a 1.1 beta for a long time)

Now I'm getting a strange compilation error when I try to run it in the simulator:

Code: Select all

   C#/XAML for HTML5: JavaScriptGenerator started for assembly "D:\Workspaces\Meridian\Meridian.WPFWeb\bin\Debug\Meridian.WPFWeb.dll".
WARNING: Unknown custom metadata item kind: 6
Decompiling
ERROR: C#/XAML for HTML5: JavaScriptGenerator failed: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at JSIL.AssemblyTranslator.AnalyzeFunctions(ParallelOptions parallelOptions, AssemblyDefinition[] assemblies, ConcurrentBag`1 methodsToAnalyze, ProgressReporter pr)
   at JSIL.AssemblyTranslator.TranslateInternal(String assemblyPath, List`1 simpleNameOfAssembliesToSkip, Boolean scanForProxies)
   at JSIL.AssemblyTranslator.Translate(String assemblyPath, List`1 simpleNameOfAssembliesToSkip, Boolean scanForProxies)
   at as.a(String A_0, String A_1, String A_2, HashSet`1 A_3, ILogger A_4, String A_5, String A_6, String A_7, String A_8, Boolean A_9, Boolean A_10, Boolean A_11, Boolean A_12, Boolean A_13, String A_14, String A_15, String A_16, String A_17, String A_18, String A_19, HashSet`1 A_20, Boolean A_21)
   at DotNetForHtml5.Compiler.JavaScriptGenerator.Execute(String sourceAssembly, String activationAppPath, String assembliesThatContainNoResX, ILogger logger, String proxies, String additionalSupportedMethods, String nameOfAssembliesThatDoNotContainUserCode, Boolean ignoreUnsupportedMethodsErrors, Boolean disableDeadCodeElimination, Boolean displayDeadCodeEliminationSkippedMembers, Boolean displayDeadCodeEliminationRetainedMembers, Boolean includeUserCodeInDeadCodeElimination, String deadCodeEliminationWhiteList, String outputRootPath, String outputAppFilesPath, String outputLibrariesPath, String outputResourcesPath, String intermediateOutputAbsolutePath, String flagsString, Boolean isBridgeBasedVersion)
C#/XAML for HTML5: Wrapper started. Source libraries directory: "System.String[]". Assembly that contains entry point: "D:\Workspaces\Meridian\Meridian.WPFWeb\bin\Debug\Meridian.WPFWeb.dll
C#/XAML for HTML5: Wrapper completed in 0 seconds.


I also get a popup error message with the following stacktrace:

Code: Select all

   at DotNetForHtml5.Core.INTERNAL_PropertyStore.GetInheritedPropertyStorage(DependencyObject dependencyObject, DependencyProperty dependencyProperty, Boolean createAndSaveNewStorageIfNotExists)
   at Windows.UI.Xaml.DependencyObject.SetInheritedValue(DependencyProperty dependencyProperty, Object value, Boolean recursively)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.HandleSpecialPropertiesThatShouldInheritDataContext(INTERNAL_PropertyStorage storage, Object newValue)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.SetInheritedValue(INTERNAL_PropertyStorage storage, Object newValue, Boolean recursively)
   at Windows.UI.Xaml.DependencyObject.SetInheritedValue(DependencyProperty dependencyProperty, Object value, Boolean recursively)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChild_Private(UIElement child, UIElement parent)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(UIElement child, UIElement parent)
   at Windows.UI.Xaml.Controls.Panel.ManageChildrenChanged(DependencyObject d, UIElementCollection oldChildren, UIElementCollection newChildren)
   at Windows.UI.Xaml.Controls.Panel.INTERNAL_OnAttachedToVisualTree()
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChild_Private(UIElement child, UIElement parent)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(UIElement child, UIElement parent)
   at Windows.UI.Xaml.Controls.UserControl.Content_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.RenderElementsAndRaiseChangedEventOnAllDependencyProperties(DependencyObject dependencyObject)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChild_Private(UIElement child, UIElement parent)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(UIElement child, UIElement parent)
   at Windows.UI.Xaml.Controls.Panel.ManageChildrenChanged(DependencyObject d, UIElementCollection oldChildren, UIElementCollection newChildren)
   at Windows.UI.Xaml.Controls.Panel.INTERNAL_OnAttachedToVisualTree()
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChild_Private(UIElement child, UIElement parent)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(UIElement child, UIElement parent)
   at Windows.UI.Xaml.Controls.UserControl.Content_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.RenderElementsAndRaiseChangedEventOnAllDependencyProperties(DependencyObject dependencyObject)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChild_Private(UIElement child, UIElement parent)
   at DotNetForHtml5.Core.INTERNAL_VisualTreeManager.AttachVisualChildIfNotAlreadyAttached(UIElement child, UIElement parent)
   at Windows.UI.Xaml.Window.OnContentChanged(Object oldContent, Object newContent)
   at Windows.UI.Xaml.Window.Content_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.OnPropertyChanged(INTERNAL_PropertyStorage storage, Object oldValue, Object newValue, PropertyMetadata typeMetadata)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.RaisePropertyChangedAndCascadeToChildren(INTERNAL_PropertyStorage storage, Object oldValue, Object newValue, PropertyMetadata typeMetadata)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.SetSpecificValue(INTERNAL_PropertyStorage storage, KindOfValue kindOfValueToSet, Object newValue, PropertyMetadata typeMetadata)
   at DotNetForHtml5.Core.INTERNAL_PropertyStore.SetLocalValue(INTERNAL_PropertyStorage storage, Object newValue)
   at Windows.UI.Xaml.DependencyObject.SetLocalValue(DependencyProperty dependencyProperty, Object value)
   at Windows.UI.Xaml.DependencyObject.SetValueInternal(DependencyProperty dependencyProperty, Object value)
   at Windows.UI.Xaml.DependencyObject.SetValue(DependencyProperty dependencyProperty, Object value)
   at Windows.UI.Xaml.Window.set_Content(Object value)
   at Meridian.App..ctor() in D:\Workspaces\Meridian\Meridian.WPFWeb\App.xaml.cs:line 30



EDIT (Solution):

It seems the issue is caused by DataContext inheritence. I opened the partially generated HTML/JS and found the following error, then I added `DataContext="{Binding .}"` to all my custom controls, and the error has disappeared.

Code: Select all

Uncaught TypeError: Cannot read property 'ContainsKey' of null
    at Object.INTERNAL_PropertyStore_GetInheritedPropertyStorage (CSharpXamlForHtml5.js?20196271027:18349)
    at Windows_UI_Xaml_Media_TranslateTransform.DependencyObject_SetInheritedValue (CSharpXamlForHtml5.js?20196271027:11124)
    at Object.INTERNAL_PropertyStore_HandleSpecialPropertiesThatShouldInheritDataContext (CSharpXamlForHtml5.js?20196271027:18461)
    at Object.INTERNAL_PropertyStore_SetInheritedValue (CSharpXamlForHtml5.js?20196271027:18554)
    at Windows_UI_Xaml_Controls_Border.DependencyObject_SetInheritedValue (CSharpXamlForHtml5.js?20196271027:11125)
    at Object.INTERNAL_VisualTreeManager_AttachVisualChild_Private (CSharpXamlForHtml5.js?20196271027:27840)
    at Object.INTERNAL_VisualTreeManager_AttachVisualChildIfNotAlreadyAttached (CSharpXamlForHtml5.js?20196271027:27864)
    at Function.Panel_ManageChildrenChanged$00 (CSharpXamlForHtml5.js?20196271027:31653)
    at Windows_UI_Xaml_Controls_Grid.Panel_INTERNAL_OnAttachedToVisualTree (CSharpXamlForHtml5.js?20196271027:31615)
    at Object.INTERNAL_VisualTreeManager_AttachVisualChild_Private (CSharpXamlForHtml5.js?20196271027:27844)
Last edited by TaterJuice on Thu Jun 27, 2019 9:33 am, edited 1 time in total.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Postby JS-Support @Userware » Thu Jun 27, 2019 9:21 am

Thanks. As for the error popup, does it contain any information other than the stack trace? (especially the exception name)

TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Re: Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Postby TaterJuice » Thu Jun 27, 2019 9:33 am

JS-Support @Userware wrote:Thanks. As for the error popup, does it contain any information other than the stack trace? (especially the exception name)


Thanks for the quick reply. The exception was a System.NullReferenceException.

I updated my question. I found a solution, but it does appear to be a bug.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Postby JS-Support @Userware » Thu Jun 27, 2019 10:10 am

Thanks. Do you know how we can reproduce the error with a simple empty project?

TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Re: Compilation Error: "WARNING: Unknown custom metadata item kind: 6"

Postby TaterJuice » Sun Jun 30, 2019 12:10 pm

So far, no, but I am working on it. It's a fairly large, cross platform project that supports CSHTML5, Desktop WPF, iOS, Android and macOS.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 33 guests