Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DialogHost: XamlObjectWriterException - Unresolved reference 'ContentCoverBorder' #3522

Open
MichelMichels opened this issue Apr 11, 2024 · 14 comments
Labels
bug evaluation required Items is pending review or evaluation by the team
Milestone

Comments

@MichelMichels
Copy link
Member

Bug explanation

When running a Window with nothing else but a DialogHost, following exception gets thrown:
System.Xaml.XamlObjectWriterException in System.Xaml.dll
Additional text: Unresolved reference 'ContentCoverBorder.

It has something to do with this PR: bfe348f

When I revert this change, the issue goes away but the binding error shows up again.

Version

5.0.0

@MichelMichels MichelMichels added bug evaluation required Items is pending review or evaluation by the team labels Apr 11, 2024
@MichelMichels
Copy link
Member Author

MichelMichels commented Apr 11, 2024

Additional context:

Above sources seem to indicate that the use of x:Reference is discouraged or even prohibited?

@alexachso
Copy link

I am experiencing the same issue with my app when I try to debug it.

@Hadramet
Copy link
Contributor

I have attempted to reproduce the issue on a new project but the problem does not occur.

@nicolaihenriksen
Copy link
Contributor

nicolaihenriksen commented Jun 10, 2024

@MichelMichels @alexachso Can any of you provide a small sample that reproduces this? I am unable to reproduce it in a simple WPF app with a Window including just a DialogHost in it. I have tried with an empty DialogHost and also with actual content, but it works in both cases for me.

I am using the latest code (i.e. project reference rather than nuget package). I also tried with the official nuget packages, and still cannot repro the issue.

@alexachso
Copy link

alexachso commented Jun 17, 2024

HI @nicolaihenriksen, I cannot reproduce either. I remember seeing it and then I commented on this issue on 29th of April. If I checkout the commits I did that day of my app and run the app, the binding failure is no longer present. Maybe it is worth mentioning that I run Visual Studio preview. Since I checkout the exact commit that I remember I had the binding failure, the problem should reproduce, but the only thing different from then and now is that since then I updated the visual studio preview version. I don't remember on which version on Visual studio preview I was on 29th of April. :( I'll keep an eye on this, and if I re-encounter it I'll let you know.

@MichelMichels
Copy link
Member Author

@nicolaihenriksen @alexachso this could be the answer. I also run the Microsoft Visual Studio preview edition. I'll update to latest version and check if the issue still occurs.

@alexachso
Copy link

Hi @MichelMichels do you still see this binding failure today? If so, maybe it is worth noting the version of you Visual studio preview you are on before updating it :)

@MichelMichels
Copy link
Member Author

@alexachso sorry, I saw your comment too late. I've already updated my Visual Studio.

But even after updating, I see following behavior:

  • Non-preview version: no exception
  • Preview version: System.Xaml.XamlObjectWriterException

The demo I'm running uses following xaml in MainWindow:

<Window
    x:Class="MDIX.TestApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:MDIX.TestApp"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    Width="800"
    Height="450"
    Style="{StaticResource MaterialDesignWindow}"
    mc:Ignorable="d">
    <Grid>
        <materialDesign:DialogHost />
    </Grid>
</Window>

So, the problem seems localized entirely in the preview version.

@alexachso
Copy link

alexachso commented Jun 17, 2024

Ok, I reproduced it.

  1. New WPF project (basic)
  2. Installed the MaterialDesignThemes nugget Version 5.0.0.
  3. Added exact same Window as @MichelMichels showed in the comment above
  4. (Forgot I did this! Probably on the 29th of April I enabled the "Enable Just My Code" option in Debugging->General). Enabling this ceased to Throw the exception when I was debugging. Now I disabled it, And sure enough the exception is still there:
image image

Here is a zip file with a basic project that does it:
MDIXDialogHostTest.zip

So do not forget, in order to have this exception appear, the "System.Xaml.XamlObjectWriterException" option must be enabled in the Exception Setting and also the option "Enable Just My Code" must be disabled.

I also tested with MDIX version 5.0.1-ci662 and it does the same.
The version of the VIsual Studio preview I am using now is: Version 17.11.0 Preview 2.0

@nicolaihenriksen
Copy link
Contributor

@alexachso @MichelMichels Awesome work guys! I will try to reproduce it with this info, and see if I can find some sort of fix that does not reintroduce the binding error.

@nicolaihenriksen
Copy link
Contributor

@alexachso @MichelMichels I can now reproduce the issue 👍 Now comes the tough part, finding a valid solution 😄

@MichelMichels
Copy link
Member Author

It is strange that it only occurs in the preview version. Could it be that preview version is running a newer runtime?

@nicolaihenriksen
Copy link
Contributor

@MichelMichels I am seeing some really weird things happening. I can repro the issue, then I change one small thing and the issue is gone. Then I change it back and the issue is still gone. Sometimes if I do a full clean (´git clean -xdf`) I can then reproduce it again, but not every time. That makes it rather difficult to know when/if you have a working fix for it...

I have seen it in both the preview and the non-preview versions, but not consistently.

@nicolaihenriksen
Copy link
Contributor

nicolaihenriksen commented Jun 18, 2024

@MichelMichels As it stands right now (on my PC), simply reverting bfe348f ensures the exception is not thrown, but it does not re-introduce the binding errors that was the original issue. Very confusing...

@Keboo Keboo added this to the 5.2.0 milestone Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation required Items is pending review or evaluation by the team
Projects
None yet
Development

No branches or pull requests

5 participants