Skip to content

Commit fd8e3e2

Browse files
Fixes Obsolete Warnings and NuGet Package Dependency Warnings (#2944)
* Fixes #2943 Fix camera package version, fix obsolete warnings * Keep `System.Formats.Asn1` Vulnerability Workaround * Update + Remove Duplicate NuGet Package * Use `is Page` instead of `is { }` * Add `new` keyword to BindableProperty * Use `.Arrange()` * Fix Obsolete Warning * Fix formatting * Update MediaManager.macios.cs * Update testing.xunit.prompt.md * Update AvatarViewImageTests.cs * Update AvatarViewImageTests.cs --------- Co-authored-by: Brandon Minnick <[email protected]>
1 parent 37c98a0 commit fd8e3e2

File tree

23 files changed

+147
-203
lines changed

23 files changed

+147
-203
lines changed

.github/prompts/dotnet/testing.xunit.prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Tests should be reliable, maintainable, provide meaningful coverage, and provide
151151
};
152152

153153
// Act
154-
testControl.Layout(new Rect(0, 0, 37, 73));
154+
testControl.Arrange(new Rect(0, 0, 37, 73));
155155
var gravatarImageSource = (GravatarImageSource)testControl.Source;
156156
bool isDisposedBefore = gravatarImageSource.IsDisposed;
157157
gravatarImageSource.Dispose();

samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPage.xaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,6 @@
4848
</mct:Expander.Content>
4949
</mct:Expander>
5050

51-
<Label Text="Expander in ListView" FontSize="24" FontAttributes="Bold"/>
52-
53-
<ListView ItemsSource="{Binding ContentCreators}"
54-
HasUnevenRows="True">
55-
<ListView.ItemTemplate>
56-
<DataTemplate>
57-
<ViewCell>
58-
<mct:Expander x:DataType="sample:ContentCreator"
59-
ExpandedChanged="Expander_ExpandedChanged">
60-
<mct:Expander.Header>
61-
<Label Text="{Binding Name}"/>
62-
</mct:Expander.Header>
63-
<mct:Expander.Content>
64-
<VerticalStackLayout>
65-
<Label Text="{Binding Resource}"/>
66-
<Image Source="{Binding Image}"
67-
WidthRequest="100"
68-
HeightRequest="100"/>
69-
</VerticalStackLayout>
70-
</mct:Expander.Content>
71-
</mct:Expander>
72-
</ViewCell>
73-
</DataTemplate>
74-
</ListView.ItemTemplate>
75-
</ListView>
76-
7751
<Label Text="Expander in CollectionView with LinearItemsLayout" FontSize="24" FontAttributes="Bold"/>
7852

7953
<CollectionView ItemsSource="{Binding ContentCreators}">

samples/CommunityToolkit.Maui.Sample/Resources/Styles/Styles.xaml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<?xaml-comp compile="true" ?>
33
<ResourceDictionary
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5-
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6-
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
76

87
<!-- Explicit styles -->
98
<Style x:Key="PopupLayout" TargetType="Layout" ApplyToDerivedTypes="true">
@@ -123,13 +122,6 @@
123122
</Setter>
124123
</Style>
125124

126-
<Style TargetType="Frame" ApplyToDerivedTypes="true" >
127-
<Setter Property="HasShadow" Value="True" />
128-
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
129-
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
130-
<Setter Property="CornerRadius" Value="8" />
131-
</Style>
132-
133125
<Style TargetType="ImageButton">
134126
<Setter Property="Opacity" Value="1" />
135127
<Setter Property="BorderColor" Value="Transparent"/>
@@ -166,11 +158,6 @@
166158
</Setter>
167159
</Style>
168160

169-
<Style TargetType="ListView">
170-
<Setter Property="SeparatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
171-
<Setter Property="RefreshControlColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
172-
</Style>
173-
174161
<Style TargetType="Picker">
175162
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
176163
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
@@ -349,16 +336,16 @@
349336
</Style>
350337

351338
<Style TargetType="Shell" ApplyToDerivedTypes="True">
352-
<Setter Property="Shell.BackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource NavBarColor}, Dark={StaticResource Gray950}}}" />
353-
<Setter Property="Shell.ForegroundColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
354-
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
355-
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
356-
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
357-
<Setter Property="Shell.NavBarHasShadow" Value="True" />
358-
<Setter Property="Shell.TabBarBackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}}" />
359-
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
360-
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
361-
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
339+
<Setter Property="BackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource NavBarColor}, Dark={StaticResource Gray950}}}" />
340+
<Setter Property="ForegroundColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
341+
<Setter Property="TitleColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
342+
<Setter Property="DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
343+
<Setter Property="UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
344+
<Setter Property="NavBarHasShadow" Value="True" />
345+
<Setter Property="TabBarBackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}}" />
346+
<Setter Property="TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
347+
<Setter Property="TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
348+
<Setter Property="TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
362349
</Style>
363350

364351
<Style TargetType="TabbedPage">

src/CommunityToolkit.Maui.Analyzers.Benchmarks/CommunityToolkit.Maui.Analyzers.Benchmarks.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<IsPackable>false</IsPackable>
1515
</PropertyGroup>
1616
<ItemGroup>
17-
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
18-
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.6" />
17+
<PackageReference Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.7" />
1918
</ItemGroup>
2019
<ItemGroup>
2120
<ProjectReference Include="..\CommunityToolkit.Maui.Analyzers.UnitTests\CommunityToolkit.Maui.Analyzers.UnitTests.csproj" />

src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
2121
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
22-
<PackageReference Include="xunit.v3" Version="3.2.0" />
22+
<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.0" />
2323
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
2424
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
2525
</ItemGroup>
@@ -37,5 +37,5 @@
3737
<ProjectReference Include="..\CommunityToolkit.Maui.MediaElement\CommunityToolkit.Maui.MediaElement.csproj" />
3838
<ProjectReference Include="..\CommunityToolkit.Maui\CommunityToolkit.Maui.csproj" />
3939
</ItemGroup>
40-
40+
4141
</Project>

src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.CodeAnalysis.CSharp.Testing;
33
using Microsoft.CodeAnalysis.Diagnostics;
44
using Microsoft.CodeAnalysis.Testing;
5+
using Xunit;
56

67
namespace CommunityToolkit.Maui.Analyzers.UnitTests;
78

src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.CodeAnalysis.CSharp.Testing;
44
using Microsoft.CodeAnalysis.Diagnostics;
55
using Microsoft.CodeAnalysis.Testing;
6+
using Xunit;
67

78
namespace CommunityToolkit.Maui.Analyzers.UnitTests;
89

src/CommunityToolkit.Maui.Camera/CameraManager.android.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ protected async Task StartUseCase(CancellationToken token)
256256

257257
if (Quality.Highest is not null)
258258
{
259-
videoRecorderBuilder = videoRecorderBuilder?.SetQualitySelector(QualitySelector.From(Quality.Highest));
259+
videoRecorderBuilder = videoRecorderBuilder.SetQualitySelector(QualitySelector.From(Quality.Highest));
260260
}
261261

262-
videoRecorder = videoRecorderBuilder?.Build();
262+
videoRecorder = videoRecorderBuilder.Build();
263263
videoCapture = VideoCapture.WithOutput(videoRecorder);
264264

265265
await StartCameraPreview(token);
@@ -285,7 +285,7 @@ protected virtual async partial Task PlatformStartCameraPreview(CancellationToke
285285
camera = await RebindCamera(processCameraProvider, cameraView.SelectedCamera, token, cameraPreview, imageCapture, videoCapture);
286286
cameraControl = camera.CameraControl;
287287

288-
var point = previewView.MeteringPointFactory?.CreatePoint(previewView.Width / 2.0f, previewView.Height / 2.0f, 0.1f);
288+
var point = previewView.MeteringPointFactory.CreatePoint(previewView.Width / 2.0f, previewView.Height / 2.0f, 0.1f);
289289
var action = new FocusMeteringAction.Builder(point).Build();
290290
camera.CameraControl?.StartFocusAndMetering(action);
291291

@@ -476,7 +476,7 @@ void SetImageCaptureTargetRotation(int rotation)
476476

477477
sealed class ImageCallBack(ICameraView cameraView) : ImageCapture.OnImageCapturedCallback
478478
{
479-
public override void OnCaptureSuccess(IImageProxy? image)
479+
public override void OnCaptureSuccess(IImageProxy image)
480480
{
481481
base.OnCaptureSuccess(image);
482482
var img = image?.Image;
@@ -524,7 +524,7 @@ public override void OnCaptureSuccess(IImageProxy? image)
524524
}
525525
}
526526

527-
public override void OnError(ImageCaptureException? exception)
527+
public override void OnError(ImageCaptureException exception)
528528
{
529529
base.OnError(exception);
530530
cameraView.OnMediaCapturedFailed(exception?.Message ?? "An unknown error occurred.");

src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353

5454
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
5555
<!-- Required NuGet Packages -->
56-
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.5.0" />
57-
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.5.0" />
58-
<PackageReference Include="Xamarin.AndroidX.Camera.Extensions" Version="1.5.0" />
56+
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.4.2.3" />
57+
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.4.2.3" />
58+
<PackageReference Include="Xamarin.AndroidX.Camera.Extensions" Version="1.4.2.3" />
5959

60-
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.11.0" />
60+
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.10.1.3" />
6161

6262
<!-- Ensure Linker does not remove required libraries -->
6363
<None Include="linker.xml" Pack="true" PackagePath="build\$(PackageId).LinkerConfigurationFile.xml" />

src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<PackageReference Include="Microsoft.Maui.Core" Version="$(MauiPackageVersion)" />
5656
<PackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiPackageVersion)" />
5757
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" Condition=" '$(Configuration)'=='Release' " PrivateAssets="All" />
58-
<PackageReference Include="System.Speech" Version="9.0.5" Condition="'$(TargetFramework)' == '$(NetVersion)-windows10.0.19041.0'" />
58+
<PackageReference Include="System.Speech" Version="10.0.0" Condition="'$(TargetFramework)' == '$(NetVersion)-windows10.0.19041.0'" />
5959
</ItemGroup>
6060

6161
<ItemGroup Condition="$(TargetFramework.Contains('-tizen'))">

0 commit comments

Comments
 (0)