Skip to content

Conversation

@hartez
Copy link
Contributor

@hartez hartez commented Oct 25, 2021

Fixes #3090

@PureWeen PureWeen enabled auto-merge (squash) October 25, 2021 23:42
@PureWeen PureWeen merged commit 26a9236 into main Oct 26, 2021
@PureWeen PureWeen deleted the fix-3090 branch October 26, 2021 09:10
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Nov 1, 2021
Context: dotnet#3018

This depends on dotnet#3108 merged first, and we will need the other mobile
workloads to implement:

    <Using Include="Android.App" Platform="Android" />
    <Using Include="Android.Widget" Platform="Android" />
    <Using Include="Android.OS.Bundle" Alias="Bundle" Platform="Android" />
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Nov 4, 2021
Context: dotnet#3018

PR dotnet#3108 was a good start in enabling implicit C# global usings.
However, there were a couple of issues to work through:

1. There is a `GlobalUsings.cs` file. Can we do this in MSBuild, so
   it's just there by default? I added:

    <ItemGroup Condition=" '$(UseMaui)' == 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <!-- %(Sdk) is only here if something later needs to identify these -->
      <Using Include="Microsoft.Extensions.DependencyInjection" Sdk="Maui" />
      <Using Include="Microsoft.Maui" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls.Hosting" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls.Xaml" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Graphics" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Essentials" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Hosting" Sdk="Maui" />
    </ItemGroup>

2. The platform-specific usings were not cleared. So types like
   `Microsoft.Maui.Controls.Application` could conflict with
   `Android.App.Application`.

To solve this, I added a `%(Platform)` metadata in the Android, iOS,
macOS, MacCatalyst, and tvOS workloads:

    <Using Include="Android.App" Platform="Android" />
    <Using Include="Android.Widget" Platform="Android" />
    <Using Include="Android.OS.Bundle" Alias="Bundle" Platform="Android" />

Then in .NET MAUI's MSBuild targets we can do:

    <ItemGroup Condition=" '$(UseMaui)' == 'true' and '$(MauiEnablePlatformUsings)' != 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <Using Remove="@(Using->HasMetadata('Platform'))" />
    </ItemGroup>

I created `$(MauiEnablePlatformUsings)`, just in case someone ever
needs to turn this off.

I updated the templates to specify `ImplicitUsings=enable`.

I updated `Controls.Sample.Tests.csproj`, as it was a .NET 6 project.
We probably can't update the other samples yet, because there are
Xamarin projects that would not support C# 10 language features.
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Nov 11, 2021
Context: dotnet#3018

PR dotnet#3108 was a good start in enabling implicit C# global usings.
However, there were a couple of issues to work through:

1. There is a `GlobalUsings.cs` file. Can we do this in MSBuild, so
   it's just there by default? I added:

    <ItemGroup Condition=" '$(UseMaui)' == 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <!-- %(Sdk) is only here if something later needs to identify these -->
      <Using Include="Microsoft.Extensions.DependencyInjection" Sdk="Maui" />
      <Using Include="Microsoft.Maui" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls.Hosting" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Controls.Xaml" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Graphics" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Essentials" Sdk="Maui" />
      <Using Include="Microsoft.Maui.Hosting" Sdk="Maui" />
    </ItemGroup>

2. The platform-specific usings were not cleared. So types like
   `Microsoft.Maui.Controls.Application` could conflict with
   `Android.App.Application`.

To solve this, I added a `%(Platform)` metadata in the Android, iOS,
macOS, MacCatalyst, and tvOS workloads:

    <Using Include="Android.App" Platform="Android" />
    <Using Include="Android.Widget" Platform="Android" />
    <Using Include="Android.OS.Bundle" Alias="Bundle" Platform="Android" />

Then in .NET MAUI's MSBuild targets we can do:

    <ItemGroup Condition=" '$(UseMaui)' == 'true' and '$(MauiEnablePlatformUsings)' != 'true' and ('$(ImplicitUsings)' == 'true' or '$(ImplicitUsings)' == 'enable') ">
      <Using Remove="@(Using->HasMetadata('Platform'))" />
    </ItemGroup>

I created `$(MauiEnablePlatformUsings)`, just in case someone ever
needs to turn this off.

I updated the templates to specify `ImplicitUsings=enable`.

I updated `Controls.Sample.Tests.csproj`, as it was a .NET 6 project.
We probably can't update the other samples yet, because there are
Xamarin projects that would not support C# 10 language features.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@samhouts samhouts added the fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] AbsoluteLayout doesn't update bounds for its children after being initially set

4 participants