none
Non-reproducible Style.Seal() issue. (Last Resort) RRS feed

  • Question

  • Ok, so here's the deal.

    I've been Googling for two weeks , to no avail. This post is kind of against all regulations, since i see everyone asking for code samples that make the issue reproducible.
    Well that is impossible for my case...

    In our company we're remodelling our application from winforms to WPF, and to have a neat layout we're using MaterialdesignInXAML toolkit (https://github.com/MaterialDesignInXAML/) , and MahApps (https://mahapps.com/).
    (These are not hyperlinks because msdn won't allow me, or something like that...)

    In one solution of our application, a weird thing happens. The solution builds fine. Two weeks ago, it ran perfectly too.
    So , nothing changed since then, and i mean literally NOTHING. We use source control, so i actually made sure i had the EXACT same source code as two weeks ago. But, alas, the solution no longer runs...

    On my computer that is. All my colleagues have tried and could run perfectly, not a single issue...
    My stacktrace:

    Unhandled Exception: System.Windows.Markup.XamlParseException: Initialization of 'MahApps.Metro.Controls.MetroThumbContentControl' threw an exception. ---> System.InvalidOperationException: Can only base on a Style with target type that is base type 'MetroThumbContentControl'.
       at System.Windows.Style.Seal()
       at System.Windows.StyleHelper.SealIfSealable(Object value)
       at System.Windows.ResourceDictionary.SealValue(Object value)
       at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
       at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
       at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
       at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
       at System.Windows.SystemResources.LookupResourceInDictionary(ResourceDictionary dictionary, Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
       at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)
       at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)
       at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)
       at System.Windows.FrameworkElement.UpdateThemeStyleProperty()
       at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
       at System.Windows.FrameworkElement.TryFireInitialized()
       at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
       --- End of inner exception stack trace ---
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
       at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
       at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
       at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
       at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
       at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
       at System.Windows.FrameworkElement.ApplyTemplate()
       at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       at System.Windows.UIElement.Measure(Size availableSize)
       at System.Windows.Interop.HwndSource.SetLayoutSize()
       at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at System.Windows.Window.SetRootVisual()
       at System.Windows.Window.SetRootVisualAndUpdateSTC()
       at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at <ApplicationName>.<SolutionName>.WPF.TestApp.App.Main()

    What i have tried (in order):
    Make sure windows updates were correctly installed.
    Remove any unnecessary extensions/plugins from vs.
    Make sure VS versions of my colleages are the same as mine.
    Make sure VS installation is identical to my colleages'.
    Clear the source control cache , and perform a pull of the code.
    Delete the working folder on my computer , clear the source control cache, and pull.
    Clear the visual studio cache, reset user preferences/settings, delete working folder, clear source control cache, and pull.

    So basically, i've done almost anything within my knowledge, except the following three:
    Reinstall Visual studio.
    Reinstall .NET Framework (and libraries and so on , the whole bunch)
    Reinstall Windows (Which i would prefer not to).

    Also, googling the exact error, gives (for me) one exact match in stacktrace , but with no extra info included.

    Please, please help me fix this , because i'm almost getting depressed about this thing.
    (slightly modified code files can be supplied, but since my colleages can run perfectly, and the code is "confidential" i will not include them right away.)


    Thx!
    Anton

    Thursday, June 13, 2019 9:20 AM

Answers


  • Hi   Anton Vandeghinste, 

    Your issue is quite strange.

    But, form the error message.

    >> Unhandled Exception: System.Windows.Markup.XamlParseException: Initialization of 'MahApps.Metro.Controls.MetroThumbContentControl' threw an exception. ---> System.InvalidOperationException: Can only base on a Style with target type that is base type 'MetroThumbContentControl'.
       at System.Windows.Style.Seal()

    This issue is more related to the MahApps.Metro.Controls.MetroThumbContentControl.

    You can go to the mahapps support center for getting suitable help.


    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 17, 2019 2:10 AM
    Moderator

  • Hi   Anton Vandeghinste, 

    Your issue is quite strange.

    But, form the error message.

    >> Unhandled Exception: System.Windows.Markup.XamlParseException: Initialization of 'MahApps.Metro.Controls.MetroThumbContentControl' threw an exception. ---> System.InvalidOperationException: Can only base on a Style with target type that is base type 'MetroThumbContentControl'.
       at System.Windows.Style.Seal()

    This issue is more related to the MahApps.Metro.Controls.MetroThumbContentControl.

    You can go to the mahapps support center for getting suitable help.


    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Posted to MahApps support, figured it out see: https://github.com/MahApps/MahApps.Metro/issues/3549

    Thursday, July 11, 2019 9:52 AM

All replies


  • Hi   Anton Vandeghinste, 

    Your issue is quite strange.

    But, form the error message.

    >> Unhandled Exception: System.Windows.Markup.XamlParseException: Initialization of 'MahApps.Metro.Controls.MetroThumbContentControl' threw an exception. ---> System.InvalidOperationException: Can only base on a Style with target type that is base type 'MetroThumbContentControl'.
       at System.Windows.Style.Seal()

    This issue is more related to the MahApps.Metro.Controls.MetroThumbContentControl.

    You can go to the mahapps support center for getting suitable help.


    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 17, 2019 2:10 AM
    Moderator
  • Hi Yong Lu,

    I'll put the question out to the mahapps support center, as you suggested.
    However, do you mind if i keep this issue open?

    I'm not quite sure if the issue can be resolved by the people at mahapps, or the mahapps community, since i'm currently the only one (apparently) that's having an issue... (?)

    Kind regards,
    Anton Vandeghinste

    Monday, June 17, 2019 9:18 AM

  • Hi   Anton Vandeghinste, 

    Your issue is quite strange.

    But, form the error message.

    >> Unhandled Exception: System.Windows.Markup.XamlParseException: Initialization of 'MahApps.Metro.Controls.MetroThumbContentControl' threw an exception. ---> System.InvalidOperationException: Can only base on a Style with target type that is base type 'MetroThumbContentControl'.
       at System.Windows.Style.Seal()

    This issue is more related to the MahApps.Metro.Controls.MetroThumbContentControl.

    You can go to the mahapps support center for getting suitable help.


    Best regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Posted to MahApps support, figured it out see: https://github.com/MahApps/MahApps.Metro/issues/3549

    Thursday, July 11, 2019 9:52 AM