Search code examples
c#validationuwpuwp-xamltemplate10

I get a DependencyProperty error if I try to customize Error Validation in Template10-Validation


I'm new at reporting this errors and it might be a noobish report from my part but I'm getting this error whenever I try to Set the DataContext={TemplateBinding Property} as shown at the example at Template 10 Validation.

I'm exploring Template 10 Validation before applying it to my own app, so I found this mistake wierd since I can't use Design Mode at x86 i'm debugging at x64 and it works fine but as soon as I tried to apply Customization it shows me this error, and at Design Mode I'm getting a error window like the one shown at the screenshot:

enter image description here

Severity Code Description Project File Line Suppression State Error The property "Property" is not a DependencyProperty. To be used in markup, non-attached properties must be exposed on the target type with an accessible instance property "Property". For attached properties, the declaring type must provide static "GetProperty" and "SetProperty" methods. SampleValidationTest E:\Template10\SampleValidationTest\SampleValidationTest\Views\MainPage.xaml 43

I've repair VS2017 and it didnt corrected it, as soon as I stopped customize the error validation, Template10 Validation works well at x64 debug mode at design mode, also the program build quite well even thought it still shown the error.

The wierdest thing is that my design mode was working fine when i was customizing this error validation and suddenly it stopped working the next day and I havent been able to solve it.

I guess i'll reinstall VS2017, it pains me to reinstall it by seems that I dont have any choice now.


Solution

  • I have spent the last couple hours trying to understand this error and I think I found the bug, when you create a Template Blank, Minimal or Hamburguer it comes with the default nuget packages of:

    • Microsoft.NETCore.UniversalWindowsPlataform version 5.2.3
    • Microsoft.Xaml.Behaviors.Uwp.Managed version 1.1.0
    • Newtonsoft.Json version 9.0.1

    I have updated the first two to 5.3.3 and 2.0.0 respectively and the Design Mode at x64 and ARM works fine when you try to customize Validation errors.

    but if you update Newtonsoft.Json to Version 10.0.1 or 10.0.2 the designer mode breaks it still build but it breaks and shows different kind of error like the one I posted and now it showed me errors on template 10 tags like for example or or at pageheader too.

    so it still build as long as you apply only inline customization because it throws an unhandled exception if you try to use a resource dictionary and try to apply it to Template property at the ControlWrapper. Designer Mode break so you wont be able to use it, the swiggly line never leaves stay there forever and also those annoying errors keep showing at error list.

    Also everytime I updated or downgraded any nuget package I had to restart VS2017 enterprise edition because it didnt refreshed template 10 designer mode I dont know the reason, but once you restarted you VS2017 the compiler refreshed appropiately.

    well for now DO NOT UPGRADE Newtonsoft.Json from 9.0.1 unless you wished to work without the designer.

    I also posted this answer at github so they can correct this soon. I dont think i have the enough level to help at that github project. :(

    But at least you can work this way with the designer working properly.