Open MarkusRodler opened 1 month ago
Workaround - provide the dependency?
If you're using Moq, add this in a OneTimeSetup / ClassInitialize
DependencyService.RegisterSingleton(Mock.Of<ISystemResourcesProvider>(x =>
x.GetSystemResources() == Mock.Of<IResourceDictionary>(d =>
d.GetEnumerator() == Enumerable.Empty<KeyValuePair<string, object>>().GetEnumerator())));
Without Moq:
[ClassInitialize]
public static void SetupApplication()
{
DependencyService.RegisterSingleton<ISystemResourcesProvider>(new MockSystemResourcesProvider());
}
internal class MockSystemResourcesProvider : ISystemResourcesProvider
{
public IResourceDictionary GetSystemResources() => new MockResourceDictionary();
}
internal class MockResourceDictionary : List<KeyValuePair<string, object>>, IResourceDictionary
{
public bool TryGetValue(string key, out object value) => throw new NotImplementedException();
public event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
}
Describe the bug
After upgrading .NET 8 to the newest version and installing the newly required workloads? wasi-experimental, maui-tizen and updating maui-android the unit tests stopped working. Disclaimer: I don't need any maui-tizen package. We have no reference to it in our codebase. It may depend on the new .NET 8 version or on the workloads. IDK
To Reproduce
[TestClass] public class AppTest { Maui.App? sut;
}
Further technical details
dotnet --info
Runtime Environment: OS Name: debian OS Version: 12 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/8.0.300/
.NET workloads installed: [maui-android] Installation Source: SDK 8.0.300 Manifest Version: 8.0.21/8.0.100 Manifest Path: /usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maui/8.0.21/WorkloadManifest.json Install Type: FileBased
[maui-tizen] Installation Source: SDK 8.0.300 Manifest Version: 8.0.21/8.0.100 Manifest Path: /usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maui/8.0.21/WorkloadManifest.json Install Type: FileBased
[wasi-experimental] Installation Source: SDK 8.0.300 Manifest Version: 8.0.5/8.0.100 Manifest Path: /usr/share/dotnet/sdk-manifests/8.0.100/microsoft.net.workload.mono.toolchain.current/8.0.5/WorkloadManifest.json Install Type: FileBased
Host: Version: 8.0.5 Architecture: x64 Commit: 087e15321b
.NET SDKs installed: 6.0.422 [/usr/share/dotnet/sdk] 7.0.409 [/usr/share/dotnet/sdk] 8.0.300 [/usr/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.30 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Previous workloads:
After .NET upgrade wasi-experimental is now needed?:
After that maui-tizen is now needed?: