none
System.NotImplementedException occurs during loading of main (empty) WPF Window RRS feed

  • Question

  • Our 6 year old WPF application has all of a sudden started throwing a NotImplementedException when starting up the first time after being updated. This app uses .Net 4 framework and we've never seen a problem until recently. One of two things has happened in the past month - either we added some bad XAML to one of the navigation windows or Microsoft has pushed some update that is making our WPF app fail when loading. The exception occurs within the MainWindow's call to the method InitializeComponent() and it appears to not find a  XAML type. The MainWindow has no content as you can see here and the header is pretty straightforward. The good news is that the application will not usually throw this exception when rerun two minutes later. Does anyone have any ideas what could cause this exception?

    <NavigationWindow x:Class="MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen"
            Title="AppX" Visibility="Hidden" ShowInTaskbar="True"
            SizeToContent="Height" Height="600" Width="700" >
    </NavigationWindow>


    Exception log:

    System.Windows.Markup.XamlParseException: The method or operation is not implemented. ---> System.NotImplementedException: The method or operation is not implemented.
    at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
    at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
    at System.Windows.Baml2006.Baml2006SchemaContext.GetPropertyDeclaringType(Int16 propertyId)
    at System.Windows.Baml2006.Baml2006Reader.GetStaticExtensionValue(Int16 valueId, Type& memberType, Object& providedValue)
    at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithExtension()
    at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
    at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
    at System.Windows.Baml2006.Baml2006Reader.Read()
    at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
    at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
    --- End of inner exception stack trace ---
    at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
    at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
    at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
    at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
    at SkyKickMigrationAssistant.MainWindow.InitializeComponent()
    at SkyKickMigrationAssistant.MainWindow..ctor()  

    Friday, May 11, 2018 10:58 PM

All replies

  • Hello,

    >>One of two things has happened in the past month - either we added some bad XAML to one of the navigation windows or Microsoft has pushed some update that is making our WPF app fail when loading

    For the first assumption, have you tried to remove the new added XAML and monitor the behavior?

    For the second one, have you found that the same issue occurred on all PC with the same Windows OS and patches installed? If so, we need further deep investigation to address issue.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 14, 2018 3:04 AM
    Moderator
  • Thanks. To the second question/suggestion: Unfortunately I have no direct access to the PCs where the problem is occurring - which makes it nearly impossible to find out the specific .Net and Windows patch levels. On top of that, the problem is not predictable and re-running the application on the same PC doesn't produce the exception. We have not been able to get this happen in a debug environment.

    In answer to the first question - yes, we have reverted our code and not seen the problem and tried gradually reintroducing the XAML changes - but because of the indeterministic nature of the problem, we have been unable to find any specific code that precipitates the problem. There is even a theory on our team that this problem with WPF may have been around since "day 1", but just didn't get logged. I'm posting to see if anyone has noticed a similar problem or if someone has a way to narrow down the cause - short of changing the Microsoft presentation framework library where the exception is being thrown to provide more information about what XAML (BAML) id it is failing to find rather than just "throw System.NotImplementedException" in System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId) when the id is not found.

    Monday, May 14, 2018 1:58 PM
  • Thanks. To the second question/suggestion: Unfortunately I have no direct access to the PCs where the problem is occurring - which makes it nearly impossible to find out the specific .Net and Windows patch levels. On top of that, the problem is not predictable and re-running the application on the same PC doesn't produce the exception. We have not been able to get this happen in a debug environment.

    In answer to the first question - yes, we have reverted our code and not seen the problem and tried gradually reintroducing the XAML changes - but because of the indeterministic nature of the problem, we have been unable to find any specific code that precipitates the problem. There is even a theory on our team that this problem with WPF may have been around since "day 1", but just didn't get logged. I'm posting to see if anyone has noticed a similar problem or if someone has a way to narrow down the cause - short of changing the Microsoft presentation framework library where the exception is being thrown to provide more information about what XAML (BAML) id it is failing to find rather than just "throw System.NotImplementedException" in System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId) when the id is not found.

    Hello,

    Well, if so, I would say the paid support(https://support.microsoft.com/en-us) will be the best choice to handle such kind of occasional problem, the engineer will contact with you and gather dump/trace without privacy risks, this will accurately locate issue as you wish.

    And also, if the public forum can also get the same issue report, it may raise the priority.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 21, 2018 6:05 AM
    Moderator
  • What was the problem?
    Wednesday, September 4, 2019 7:27 AM