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

Add .net 9 to platform #931

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
branches: [master]
schedule:
- cron: '26 22 * * 0'

env:
caliburn_sln : "src\\caliburn.micro.sln"
jobs:
analyse:
name: Analyse
Expand Down Expand Up @@ -65,10 +66,10 @@ jobs:
run: dotnet workload list

- name: Restore nuget packages
run: msbuild src\caliburn.micro.sln -t:restore
run: msbuild ${{env.caliburn_sln}} -t:restore

- name: Build app for release
run: msbuild src\caliburn.micro.sln /t:Build
run: msbuild ${{env.caliburn_sln}} /t:Build

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand Down
2 changes: 1 addition & 1 deletion azure-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:
displayName: 'Install .NET'
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '9.0.x'


- task: PowerShell@2
Expand Down
6 changes: 3 additions & 3 deletions samples/features/Features.NetFive/Features.DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>Features.CrossPlatform</AssemblyName>
<RootNamespace>Features.CrossPlatform</RootNamespace>
Expand All @@ -23,10 +23,10 @@

<ItemGroup>
<Reference Include="Caliburn.Micro.Core">
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net8.0-windows\Caliburn.Micro.Core.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net9.0-windows\Caliburn.Micro.Core.dll</HintPath>
</Reference>
<Reference Include="Caliburn.Micro.Platform">
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net8.0-windows\Caliburn.Micro.Platform.dll</HintPath>
<HintPath>..\..\..\bin\Caliburn.Micro.Platform\release\net9.0-windows\Caliburn.Micro.Platform.dll</HintPath>
</Reference>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/setup/Setup.UWP/Setup.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<Version>4.0.173</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.12</Version>
<Version>6.2.14</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/setup/Setup.WPF.Core.VB/Bootstrapper.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Public Class Bootstrapper
End Sub

Protected Overrides Sub OnStartup(sender As Object, e As StartupEventArgs)
DisplayRootViewFor(Of ShellViewModel)()
DisplayRootViewForAsync(Of ShellViewModel)()
End Sub

Protected Overrides Function GetInstance(service As Type, key As String) As Object
Expand Down
4 changes: 2 additions & 2 deletions samples/setup/Setup.WPF.Core.VB/Setup.WPF.Core.VB.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<RootNamespace>Setup.WPF.Core.VB</RootNamespace>
<UseWPF>true</UseWPF>
</PropertyGroup>
Expand All @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Caliburn.Micro" Version="4.0.173" />
<PackageReference Include="Caliburn.Micro" Version="4.0.212" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 1 addition & 4 deletions samples/setup/Setup.WPF.Core/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Caliburn.Micro;
using Setup.WPF.Core.ViewModels;
Expand Down Expand Up @@ -30,7 +27,7 @@ protected override void Configure()

protected override void OnStartup(object sender, StartupEventArgs e)
{
DisplayRootViewFor<ShellViewModel>();
DisplayRootViewForAsync<ShellViewModel>();
}

protected override object GetInstance(Type service, string key)
Expand Down
4 changes: 2 additions & 2 deletions samples/setup/Setup.WPF.Core/Setup.WPF.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Caliburn.Micro" Version="4.0.173" />
<PackageReference Include="Caliburn.Micro" Version="4.0.212" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/Caliburn.Micro.Core.Tests/EventAggregatorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public void A_valid_subscriber_is_assigned_as_a_handler_its_message_type()
{
var handlerStub = new Mock<IHandle<object>>().Object;
var aggregator = new EventAggregator();

Assert.False(aggregator.HandlerExistsFor(typeof(object)));
var messageType = typeof(object);
Assert.False(aggregator.HandlerExistsFor(messageType));

aggregator.SubscribeOnPublishedThread(handlerStub);

Assert.True(aggregator.HandlerExistsFor(typeof(object)));
Assert.True(aggregator.HandlerExistsFor(messageType));
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Caliburn.Micro.Core/EventAggregator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ namespace Caliburn.Micro
/// <inheritdoc />
public class EventAggregator : IEventAggregator
{
private static readonly ILog Log = LogManager.GetLog(typeof(EventAggregator));

private readonly List<Handler> _handlers = new List<Handler>();

/// <inheritdoc />
public virtual bool HandlerExistsFor(Type messageType)
{
lock (_handlers)
{
Log.Info("Checking if handler exists for {0}.", messageType.FullName);
Log.Info("There are {0} handlers registered.", _handlers.Count);
return _handlers.Any(handler => handler.Handles(messageType) && !handler.IsDead);
}
}
Expand All @@ -38,9 +42,10 @@ public virtual void Subscribe(object subscriber, Func<Func<Task>, Task> marshal)
{
if (_handlers.Any(x => x.Matches(subscriber)))
{
Log.Info("Message Handler exists");
return;
}

Log.Info("Message Handler Adding it");
_handlers.Add(new Handler(subscriber, marshal));
}
}
Expand Down
18 changes: 17 additions & 1 deletion src/Caliburn.Micro.Platform/Caliburn.Micro.Platform.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFrameworks>net462;uap10.0.19041;net8.0-android;net8.0-ios;net8.0-windows;</TargetFrameworks>
<TargetFrameworks>net462;uap10.0.19041;net8.0-android;net8.0-ios;net9.0-android;net9.0-ios;net8.0-windows;net9.0-windows</TargetFrameworks>
<PackageId>Caliburn.Micro</PackageId>
<Product>Caliburn.Micro</Product>
<RootNamespace>Caliburn.Micro</RootNamespace>
Expand Down Expand Up @@ -52,6 +52,10 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<Compile Include="Platforms\net46-netcore\**\*.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-windows'">
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<Compile Include="Platforms\net46-netcore\**\*.cs" />
</ItemGroup>

<ItemGroup Label="Package">
<None Include="..\..\CaliburnIcon.png">
Expand Down Expand Up @@ -79,6 +83,18 @@
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
<Compile Remove="*.cs" />
<Compile Include="Platforms\android\**\*.cs" />
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-ios'">
<Compile Remove="*.cs" />
<Compile Include="Platforms\ios\**\*.cs" />
<Compile Include="ViewModelLocator.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.146" />
Expand Down
2 changes: 1 addition & 1 deletion src/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.x",
"version": "9.0.x",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
Expand Down
Loading