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

XML processing instructions changed automatically (Xamarin) #181

Closed
renao opened this issue Apr 9, 2019 · 3 comments
Closed

XML processing instructions changed automatically (Xamarin) #181

renao opened this issue Apr 9, 2019 · 3 comments

Comments

@renao
Copy link
Contributor

renao commented Apr 9, 2019

Hello everyone,

thanks for this great tool and its Visual Studio integration.

I love it, ever since I discovered it some months ago 👍

For me it worked like a charm until I tried to add some XAML-files to my Xamarin.Forms project, which have no code behind-files.

By definition I do need to declare the <?xaml-comp compile="true" ?> node at the top of the file, but unfortunately this line changes on save to <?Mapping compile="true" ?>, if the XAML Styler extension is activated in my Visual Studio 2017 Enterprise IDE .

I tried to find a configuration or a "ignore-list" to avoid automatically "excluding" my XAMLs from compilation - but without success.

Does this happen on purpose or is this just a bug?

I honestly do not understand the <?Mapping compile="true" ?> line at all - perhaps because of my bad searching skills? - so I don't want to blame your great tool, because of some missing knowledge here.

Anyway this could be some unwanted behaviour and I really want to reactivate XAML Styler in my projects 😉

It would be great, if you could have a look at this and let me know what the problem is/could be 👍

Example.xaml

<?xml version="1.0" encoding="UTF-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:ui="clr-namespace:UI.Components">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Colors.xaml" />
        <ResourceDictionary Source="Fonts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type ui:PrimaryButton}">
        <Setter Property="BackgroundColor" Value="{StaticResource Color__Primary_Button}" />
        <Setter Property="TextColor" Value="{StaticResource Color__Primary_Button_Label}" />
    </Style>

    <Style TargetType="{x:Type ui:SecondaryButton}">
        <Setter Property="BackgroundColor" Value="{StaticResource Color__Secondary_Button}" />
        <Setter Property="TextColor" Value="{StaticResource Color__Secondary_Button_Label}" />
    </Style>

    <Style TargetType="{x:Type ui:IconToggleButton}" BasedOn="{StaticResource Font__Icon_Font}">
        <Setter Property="TextColor" Value="{StaticResource Color__Secondary_Button_Label}" />
        <Setter Property="HorizontalTextAlignment" Value="Center" />
        <Setter Property="VerticalTextAlignment" Value="Center"/>
    </Style>

</ResourceDictionary>
@grochocki
Copy link
Contributor

Hmm, interesting. This appears to be a bug affecting Xamarin.

I tried to find a configuration or a "ignore-list" to avoid automatically "excluding" my XAMLs from compilation - but without success.

This is not currently possible, but it is on our backlog (#9 and #44). Even if this were available as a workaround, I think we would still want to address the underlying issue here IRT <?xaml-comp compile="true" ?>.

@renao
Copy link
Contributor Author

renao commented Apr 18, 2019

Thank you for your response @grochocki

Perhaps I have some spare time around the upcoming holidays to dive a bit more into the structure of this project to prepare a "possible fix"-PR :-) 🥚 🐰

@grochocki grochocki changed the title XML processing instructions changed automatically XML processing instructions changed automatically (Xamarin) Sep 23, 2019
@grochocki
Copy link
Contributor

Some useful resources on XML processing instructions for future reference:

@grochocki grochocki added this to the 3.3 milestone Dec 22, 2019
2coder pushed a commit to 2coder/XamlStyler that referenced this issue Feb 5, 2020
…avalon#215)

* Use XmlNode.Name in PI-Processing

relates Issue Xavalon#181

* Add test case based in Issue Xavalon#181

Extended bug scenario by using multiple processing instructions at once.

* Update handling of process instructions

* Remove unnecessary whitespace
* Reduce test-files to its minimum

Use interpolation instead of String.Builder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants