Skip to content

Assembly name in XML namespace definition must be case-sensitive, otherwise getting NotImplementedException #5249

Open
@wojciechsura

Description

@wojciechsura
  • .NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info)
    Bug found in .NET Framework 4.7.2, however it may happen as well in .NET Core

  • Windows version: (winver)
    Windows 10 version 18363.1734

  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes/No
    Unknown

  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? If yes, please file the issue via the instructions here.
    No

Problem description:

When there's a mismatch in assembly name casing in XML namespace definition, NotImplementedException is thrown without any useful information on what went wrong.

The actual exception is thrown in Baml2006SchemaContext.cs, ResolveBamlType.

Actual behavior:

NotImplementedException is thrown.

Expected behavior:

If assembly name in XML namespace definition is case-sensitive, that's fine, but then:

  • Code Insight should probably point that out as an error (it reacts properly if the name is completely wrong)
  • Exception message should be more insightful, eg. "Cannot find assembly with name MsLib defined in namespace xyz"

Minimal repro:

To reproduce:

  • Create solution with two projects: WPF application and a class library
  • Create a view in WPF application
  • Add namespace declaration pointing out to the second project and misspell the assembly by the casing (eg. MsLib instead of MSLib)
  • Use that namespace (eg. put converter in there or a user control)

It may be important (or not), that in my case the problem happened in Windows Forms application, which used ElementHost to display WPF content inside WinForms window. In that case the application should be WF instead of WPF and should host a custom WPF control, but other than that, repro steps doesn't differ.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions