Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] After #7531 some XAML namespaces require assembly #7830

Closed
VitalyKnyazev opened this issue Oct 4, 2019 · 4 comments
Closed

[Bug] After #7531 some XAML namespaces require assembly #7830

VitalyKnyazev opened this issue Oct 4, 2019 · 4 comments

Comments

@VitalyKnyazev
Copy link
Contributor

VitalyKnyazev commented Oct 4, 2019

Description

Ironically after #7531 some XAML namespaces require assembly name otherwise the app just crashes.

Steps to Reproduce

  1. Add a XAML element like Button and set its Text to a string property of a static class like
    "public static class ResourceStrings", for example Text="{x:Static resources:ResourceStrings.SomeText}"
  2. Namespace xmlns:resources="clr-namespace:App.Core" worked ok before 4.3.0.851321-pre3
  3. Now namespace like xmlns:resources="clr-namespace:App.Core;assembly=App.Portable" is necessary to avoid the crash.

Expected Behavior

xmlns:resources="clr-namespace:App.Core" should be enough

Actual Behavior

The app crashes unless assembly is specified
xmlns:resources="clr-namespace:AppCore;assembly=App.Portable"

Basic Information

  • Version with issue: 4.3.0.851321-pre3
  • Last known good version: 4.3.0.819712-pre2
  • IDE: VS2019 16.3.2
  • Platform Target Frameworks:
    • iOS: 13.2.0.42
    • Android: 10.0.0.43
@VitalyKnyazev VitalyKnyazev added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 4, 2019
@PureWeen
Copy link
Contributor

PureWeen commented Oct 5, 2019

@StephaneDelcroix

@StephaneDelcroix StephaneDelcroix added i/regression s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. labels Oct 5, 2019
@StephaneDelcroix
Copy link
Member

please provide a repro project as soon as you can. thanks

@VitalyKnyazev
Copy link
Contributor Author

Hi @StephaneDelcroix

Here is the project:
https://github.com/VitalyKnyazev/StaticCrash

It is a bit trickier than I thought:

  • x:Static must be within DataTemplate
  • XamlCompilation must be off

If you change
xmlns:core="clr-namespace:StaticCrash"
to
xmlns:core="clr-namespace:StaticCrash;assembly=StaticCrash"
then it also works.

Off topic - is it worth turning off XAML compilation in DEBUG mode?

@StephaneDelcroix StephaneDelcroix removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Oct 5, 2019
@StephaneDelcroix
Copy link
Member

Thanks, will look at that.

Off topic - is it worth turning off XAML compilation in DEBUG mode?

well, yes and no

yes:

  • (1) it speeds up the dev cycle

no:

  • (2) you'll miss a lot of error usually caught at compile-time with XamlC on
  • (3) the application you're currently debugging is not the same that the one you'll release, and you have to make sure you're testing it in Release mode as well (this is always a good advice, btw)

To get the gain from (1), and keep the validation, we introduced a new flag that only does the validation part, but doesn't actually write the assembly back (#7407). This will be available in 4.3. We're still considering enabling that by default.

@StephaneDelcroix StephaneDelcroix removed the s/unverified New report that has yet to be verified label Oct 7, 2019
StephaneDelcroix added a commit that referenced this issue Oct 7, 2019
regression introduced by #7531

- fixes #7830
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this issue Oct 16, 2019
felipebaltazar pushed a commit to felipebaltazar/Xamarin.Forms that referenced this issue Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants