dotnet / dotnet/wpf

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

Open
#5,249 0 comments 1 reaction 0 assignees View on GitHub
.NET Framework area-Build Feature Request
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* .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](https://docs.microsoft.com/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2019).
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.