Skip to content

Commit

Permalink
Add net5.0 and net6.0 TFM (#123)
Browse files Browse the repository at this point in the history
* Update to NET 6.0

* Update #if defs

* Update Folder Structure

* Move Solution Files

* Delete global.json

* Update azure-pipelines.yml

* Add .NET 6.0

* Fix `cref`

* Update Folder Name

* Update AndroidManifest.xml

* Reduce .NET Core SDK

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Increase Unit Tests to .NET Core 2.1

* Update azure-pipelines.yml
  • Loading branch information
brminnick authored Jul 3, 2022
1 parent 8937922 commit e41c1fd
Show file tree
Hide file tree
Showing 108 changed files with 5,160 additions and 316 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/Src"
directory: "/"
schedule:
interval: "daily"
292 changes: 146 additions & 146 deletions Src/AsyncAwaitBestPractices.sln → AsyncAwaitBestPractices.sln

Large diffs are not rendered by default.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>AsyncAwaitBestPracticesMVVM.snk</AssemblyOriginatorKeyFile>
<AssemblyName>AsyncAwaitBestPractices.MVVM</AssemblyName>
Expand Down Expand Up @@ -30,12 +30,12 @@
- Add NuGet README
- Improve Nullablitiy
</PackageReleaseNotes>
<Version>6.0.4</Version>
<Version>6.0.5</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/brminnick/AsyncAwaitBestPractices</RepositoryUrl>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>6.0.4</AssemblyVersion>
<AssemblyFileVersion>6.0.4</AssemblyFileVersion>
<AssemblyVersion>6.0.5</AssemblyVersion>
<AssemblyFileVersion>6.0.5</AssemblyFileVersion>
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<Authors>Brandon Minnick, John Thiriet</Authors>
<Owners>Brandon Minnick</Owners>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected private BaseAsyncCommand(Func<TExecute?, Task>? execute,
/// <param name="parameter">Data used by the command. If the command does not require data to be passed, this object can be set to null.</param>
private protected Task ExecuteAsync(TExecute? parameter) => _execute(parameter);

bool ICommand.CanExecute(object parameter) => parameter switch
bool ICommand.CanExecute(object? parameter) => parameter switch
{
TCanExecute validParameter => CanExecute(validParameter),
null when IsNullable<TCanExecute>() => CanExecute((TCanExecute?)parameter),
Expand Down
2 changes: 1 addition & 1 deletion Src/AsyncAwaitBestPractices.MVVM/BaseCommand.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class BaseCommand<TCanExecute>
/// <summary>
/// Occurs when changes occur that affect whether or not the command should execute
/// </summary>
public event EventHandler CanExecuteChanged
public event EventHandler? CanExecuteChanged
{
add => _weakEventManager.AddEventHandler(value);
remove => _weakEventManager.RemoveEventHandler(value);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.0;net5.0;net6.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
16 changes: 7 additions & 9 deletions Src/AsyncAwaitBestPractices/AsyncAwaitBestPractices.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>AsyncAwaitBestPractices.snk</AssemblyOriginatorKeyFile>
<AssemblyName>AsyncAwaitBestPractices</AssemblyName>
Expand Down Expand Up @@ -32,12 +32,12 @@
- Add NuGet README
- Improve Nullablitiy
</PackageReleaseNotes>
<Version>6.0.4</Version>
<Version>6.0.5</Version>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/brminnick/AsyncAwaitBestPractices</RepositoryUrl>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>6.0.4</AssemblyVersion>
<AssemblyFileVersion>6.0.4</AssemblyFileVersion>
<AssemblyVersion>6.0.5</AssemblyVersion>
<AssemblyFileVersion>6.0.5</AssemblyFileVersion>
<PackageVersion>$(Version)$(VersionSuffix)</PackageVersion>
<Authors>Brandon Minnick, John Thiriet</Authors>
<Owners>Brandon Minnick</Owners>
Expand All @@ -61,9 +61,6 @@
<PropertyGroup Condition=" '$(Configuration)'=='Release' ">
<!-- Manage TargetFrameworks for distribution (Release Mode) -->
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)'=='Release' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<Compile Include="**/*.shared.cs" />
<Compile Include="**/*.shared.*.cs" />
Expand All @@ -77,10 +74,11 @@
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('netstandard2.1')) ">
</ItemGroup>
<ItemGroup>
<PackageReference Update="NETStandard.Library" PrivateAssets="all" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)'=='Release' ">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static partial class SafeFireAndForgetExtensions
public static void SafeFireAndForget<TException>(this Task task, in Action<TException>? onException = null, in bool continueOnCapturedContext = false) where TException : Exception => HandleSafeFireAndForget(task, continueOnCapturedContext, onException);



/// <summary>
/// Initialize SafeFireAndForget
///
Expand Down Expand Up @@ -80,7 +79,7 @@ static async void HandleSafeFireAndForget<TException>(ValueTask valueTask, bool
{
await valueTask.ConfigureAwait(continueOnCapturedContext);
}
catch (TException ex) when (_onException != null || onException != null)
catch (TException ex) when (_onException is not null || onException is not null)
{
HandleException(ex, onException);

Expand All @@ -95,7 +94,7 @@ static async void HandleSafeFireAndForget<TException>(Task task, bool continueOn
{
await task.ConfigureAwait(continueOnCapturedContext);
}
catch (TException ex) when (_onException != null || onException != null)
catch (TException ex) when (_onException is not null || onException is not null)
{
HandleException(ex, onException);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void AddRemoveEvents(in string eventName, in Dictionary<string, List<Subs
var typeRTDynamicMethod = typeInfoRTDynamicMethod?.AsType();

return (typeInfoRTDynamicMethod?.IsAssignableFrom(rtDynamicMethod.GetType().GetTypeInfo()) ?? false) ?
(DynamicMethod)typeRTDynamicMethod.GetRuntimeFields().First(f => f.Name is "m_owner").GetValue(rtDynamicMethod)
(DynamicMethod?)typeRTDynamicMethod?.GetRuntimeFields().First(f => f.Name is "m_owner").GetValue(rtDynamicMethod)
: null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Runtime.CompilerServices;
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

Expand All @@ -13,7 +13,7 @@ public partial class WeakEventManager<TEventArgs>
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] EventHandler<TEventArgs>? handler, [CallerMemberName, NotNull] string eventName = "")
#else
public void AddEventHandler(EventHandler<TEventArgs>? handler, [CallerMemberName] string eventName = "")
Expand All @@ -27,7 +27,7 @@ public void AddEventHandler(EventHandler<TEventArgs>? handler, [CallerMemberName
/// </summary>
/// <param name="action">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] Action<TEventArgs>? action, [CallerMemberName, NotNull] string eventName = "")
#else
public void AddEventHandler(Action<TEventArgs>? action, [CallerMemberName] string eventName = "")
Expand All @@ -41,7 +41,7 @@ public void AddEventHandler(Action<TEventArgs>? action, [CallerMemberName] strin
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] EventHandler<TEventArgs>? handler, [CallerMemberName, NotNull] string eventName = "")
#else
public void RemoveEventHandler(EventHandler<TEventArgs>? handler, [CallerMemberName] string eventName = "")
Expand All @@ -55,7 +55,7 @@ public void RemoveEventHandler(EventHandler<TEventArgs>? handler, [CallerMemberN
/// </summary>
/// <param name="action">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] Action<TEventArgs>? action, [CallerMemberName, NotNull] string eventName = "")
#else
public void RemoveEventHandler(Action<TEventArgs>? action, [CallerMemberName] string eventName = "")
Expand Down Expand Up @@ -90,7 +90,7 @@ public partial class WeakEventManager
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] Delegate? handler, [CallerMemberName, NotNull] string eventName = "")
#else
public void AddEventHandler(Delegate? handler, [CallerMemberName] string eventName = "")
Expand All @@ -104,7 +104,7 @@ public void AddEventHandler(Delegate? handler, [CallerMemberName] string eventNa
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] Delegate? handler, [CallerMemberName, NotNull] string eventName = "")
#else
public void RemoveEventHandler(Delegate? handler, [CallerMemberName] string eventName = "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
using System.Diagnostics.CodeAnalysis;
#endif

Expand All @@ -23,7 +23,7 @@ public partial class WeakEventManager<TEventArgs>
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] in EventHandler<TEventArgs>? handler, [CallerMemberName, NotNull] in string eventName = "")
#else
public void AddEventHandler(in EventHandler<TEventArgs>? handler, [CallerMemberName] in string eventName = "")
Expand All @@ -43,7 +43,7 @@ public void AddEventHandler(in EventHandler<TEventArgs>? handler, [CallerMemberN
/// </summary>
/// <param name="action">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] in Action<TEventArgs>? action, [CallerMemberName, NotNull] in string eventName = "")
#else
public void AddEventHandler(in Action<TEventArgs>? action, [CallerMemberName] in string eventName = "")
Expand All @@ -63,7 +63,7 @@ public void AddEventHandler(in Action<TEventArgs>? action, [CallerMemberName] in
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] in EventHandler<TEventArgs>? handler, [CallerMemberName, NotNull] in string eventName = "")
#else
public void RemoveEventHandler(in EventHandler<TEventArgs>? handler, [CallerMemberName] in string eventName = "")
Expand All @@ -83,7 +83,7 @@ public void RemoveEventHandler(in EventHandler<TEventArgs>? handler, [CallerMemb
/// </summary>
/// <param name="action">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] in Action<TEventArgs>? action, [CallerMemberName, NotNull] in string eventName = "")
#else
public void RemoveEventHandler(in Action<TEventArgs>? action, [CallerMemberName] in string eventName = "")
Expand Down Expand Up @@ -128,7 +128,7 @@ public partial class WeakEventManager
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void AddEventHandler([NotNull] in Delegate? handler, [CallerMemberName, NotNull] in string eventName = "")
#else
public void AddEventHandler(in Delegate? handler, [CallerMemberName] in string eventName = "")
Expand All @@ -148,7 +148,7 @@ public void AddEventHandler(in Delegate? handler, [CallerMemberName] in string e
/// </summary>
/// <param name="handler">Handler</param>
/// <param name="eventName">Event name</param>
#if NETSTANDARD2_1
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
public void RemoveEventHandler([NotNull] in Delegate? handler, [CallerMemberName, NotNull] in string eventName = "")
#else
public void RemoveEventHandler(in Delegate? handler, [CallerMemberName] in string eventName = "")
Expand Down
19 changes: 0 additions & 19 deletions Src/HackerNews.Droid/Assets/AboutAssets.txt

This file was deleted.

49 changes: 0 additions & 49 deletions Src/HackerNews.UITests/HackerNews.UITests.csproj

This file was deleted.

Loading

0 comments on commit e41c1fd

Please sign in to comment.