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

Housekeeping - Update usings and namespaces #3702

Merged
merged 3 commits into from
Dec 31, 2023
Merged
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
12 changes: 6 additions & 6 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<XunitVersion>2.6.1</XunitVersion>
<XunitVersion>2.6.4</XunitVersion>
</PropertyGroup>
<!--<PropertyGroup Condition="$(IsTestProject) != 'true'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -52,13 +52,13 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.console" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
<PackageReference Include="Xunit.StaFact" Version="1.1.11" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.0" PrivateAssets="All" />
<PackageReference Include="Verify.Xunit" Version="22.5.0" />
<PackageReference Include="Verify.Xunit" Version="22.11.1" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true'">
Expand All @@ -77,8 +77,8 @@

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.507" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.6.2" PrivateAssets="All" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.7.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
Expand Down
3 changes: 0 additions & 3 deletions src/ReactiveUI.Maui/Common/AutoDataTemplateBindingHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
// See the LICENSE file in the project root for full license information.

#if WINUI_TARGET
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
using Microsoft.Maui;
#endif

#if IS_MAUI
namespace ReactiveUI.Maui;
#else
namespace ReactiveUI;
#endif

/// <summary>
/// This type convert converts between Boolean and XAML Visibility - the
Expand Down
4 changes: 4 additions & 0 deletions src/ReactiveUI.Maui/Common/ReactivePage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
using Microsoft.Maui.Controls;
#endif

#if IS_MAUI
namespace ReactiveUI.Maui;
#else
namespace ReactiveUI;
#endif

/// <summary>
/// A <see cref="Page"/> that is reactive.
Expand Down
7 changes: 4 additions & 3 deletions src/ReactiveUI.Maui/Common/ReactiveUserControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
// See the LICENSE file in the project root for full license information.

#if WINUI_TARGET
using System;
using System.Diagnostics.CodeAnalysis;

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

#if IS_MAUI
namespace ReactiveUI.Maui;
#else
namespace ReactiveUI;
#endif

/// <summary>
/// A <see cref="UserControl"/> that is reactive.
Expand Down
14 changes: 1 addition & 13 deletions src/ReactiveUI.Maui/Common/ViewModelViewHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

#if WINUI_TARGET
using System;
using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;

using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;

using Splat;

namespace ReactiveUI;

Expand All @@ -22,8 +12,7 @@ namespace ReactiveUI;
/// the ViewModel property and display it. This control is very useful
/// inside a DataTemplate to display the View associated with a ViewModel.
/// </summary>
public
class ViewModelViewHost : TransitioningContentControl, IViewFor, IEnableLogger
public class ViewModelViewHost : TransitioningContentControl, IViewFor, IEnableLogger
{
/// <summary>
/// The default content dependency property.
Expand Down Expand Up @@ -158,4 +147,3 @@ private void ResolveViewForViewModel(object? viewModel, string? contract)
Content = viewInstance;
}
}
#endif
5 changes: 1 addition & 4 deletions src/ReactiveUI.Maui/Registrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public class Registrations : IWantsToRegisterStuff
/// <inheritdoc/>
public void Register(Action<Func<object>, Type> registerFunction)
{
if (registerFunction is null)
{
throw new ArgumentNullException(nameof(registerFunction));
}
ArgumentNullException.ThrowIfNull(registerFunction);

registerFunction(() => new ActivationForViewFetcher(), typeof(IActivationForViewFetcher));
registerFunction(() => new BooleanToVisibilityTypeConverter(), typeof(IBindingTypeConverter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@
// See the LICENSE file in the project root for full license information.

#if WINUI_TARGET
using System;
using System.Globalization;
#if IS_MAUI
using System.Linq.Expressions;
using System.Reactive.Disposables;
using System.Reactive.Linq;
#endif
using System.Reflection;

using Microsoft.UI.Xaml;

using Splat;

namespace ReactiveUI;

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion src/ReactiveUI.Maui/WinUI/DispatcherQueueScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
// <auto-generated />

#if WINUI_TARGET
using System.Reactive.Disposables;
#if IS_MAUI
using System.Threading;
#endif
using Microsoft.UI.Dispatching;

namespace System.Reactive.Concurrency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1058,4 +1058,4 @@ namespace ReactiveUI
public static System.IObservable<TRet> WhenAnyObservable<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this TSender? sender, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T1>?>> obs1, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T2>?>> obs2, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T3>?>> obs3, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T4>?>> obs4, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T5>?>> obs5, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T6>?>> obs6, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T7>?>> obs7, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T8>?>> obs8, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T9>?>> obs9, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T10>?>> obs10, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T11>?>> obs11, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T12>?>> obs12, System.Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet> selector)
where TSender : class { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1058,4 +1058,4 @@ namespace ReactiveUI
public static System.IObservable<TRet> WhenAnyObservable<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this TSender? sender, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T1>?>> obs1, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T2>?>> obs2, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T3>?>> obs3, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T4>?>> obs4, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T5>?>> obs5, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T6>?>> obs6, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T7>?>> obs7, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T8>?>> obs8, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T9>?>> obs9, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T10>?>> obs10, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T11>?>> obs11, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T12>?>> obs12, System.Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet> selector)
where TSender : class { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1051,4 +1051,4 @@ namespace ReactiveUI
public static System.IObservable<TRet> WhenAnyObservable<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this TSender? sender, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T1>?>> obs1, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T2>?>> obs2, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T3>?>> obs3, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T4>?>> obs4, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T5>?>> obs5, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T6>?>> obs6, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T7>?>> obs7, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T8>?>> obs8, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T9>?>> obs9, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T10>?>> obs10, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T11>?>> obs11, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T12>?>> obs12, System.Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet> selector)
where TSender : class { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,10 @@ namespace ReactiveUI
{
System.IDisposable BindInteraction<TViewModel, TView, TInput, TOutput>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, ReactiveUI.IInteraction<TInput, TOutput>>> propertyName, System.Func<ReactiveUI.IInteractionContext<TInput, TOutput>, System.Threading.Tasks.Task> handler)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
System.IDisposable BindInteraction<TViewModel, TView, TInput, TOutput, TDontCare>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, ReactiveUI.IInteraction<TInput, TOutput>>> propertyName, System.Func<ReactiveUI.IInteractionContext<TInput, TOutput>, System.IObservable<TDontCare>> handler)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
}
public interface IInteractionContext<out TInput, in TOutput>
{
Expand Down Expand Up @@ -275,26 +273,21 @@ namespace ReactiveUI
"isViewModel"})]
ReactiveUI.IReactiveBinding<TView, System.ValueTuple<object?, bool>> Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, TVMProp?>> vmProperty, System.Linq.Expressions.Expression<System.Func<TView, TVProp>> viewProperty, System.IObservable<TDontCare>? signalViewUpdate, System.Func<TVMProp?, TVProp> vmToViewConverter, System.Func<TVProp, TVMProp?> viewToVmConverter, ReactiveUI.TriggerUpdate triggerUpdate = 0)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
[return: System.Runtime.CompilerServices.TupleElementNames(new string?[]?[] {
"view",
"isViewModel"})]
ReactiveUI.IReactiveBinding<TView, System.ValueTuple<object?, bool>> Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, TVMProp?>> vmProperty, System.Linq.Expressions.Expression<System.Func<TView, TVProp>> viewProperty, System.IObservable<TDontCare>? signalViewUpdate, object? conversionHint, ReactiveUI.IBindingTypeConverter? vmToViewConverterOverride = null, ReactiveUI.IBindingTypeConverter? viewToVMConverterOverride = null, ReactiveUI.TriggerUpdate triggerUpdate = 0)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
System.IDisposable BindTo<TValue, TTarget, TTValue>(System.IObservable<TValue> observedChange, TTarget? target, System.Linq.Expressions.Expression<System.Func<TTarget, TTValue?>> propertyExpression, object? conversionHint, ReactiveUI.IBindingTypeConverter? vmToViewConverterOverride = null)
where TTarget : class
;
where TTarget : class;
ReactiveUI.IReactiveBinding<TView, TOut> OneWayBind<TViewModel, TView, TProp, TOut>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, TProp?>> vmProperty, System.Linq.Expressions.Expression<System.Func<TView, TOut>> viewProperty, System.Func<TProp, TOut> selector)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
ReactiveUI.IReactiveBinding<TView, TVProp> OneWayBind<TViewModel, TView, TVMProp, TVProp>(TViewModel? viewModel, TView view, System.Linq.Expressions.Expression<System.Func<TViewModel, TVMProp?>> vmProperty, System.Linq.Expressions.Expression<System.Func<TView, TVProp>> viewProperty, object? conversionHint, ReactiveUI.IBindingTypeConverter? vmToViewConverterOverride = null)
where TViewModel : class
where TView : class, ReactiveUI.IViewFor
;
where TView : class, ReactiveUI.IViewFor;
}
public interface IPropertyBindingHook
{
Expand Down Expand Up @@ -1063,4 +1056,4 @@ namespace ReactiveUI
public static System.IObservable<TRet> WhenAnyObservable<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this TSender? sender, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T1>?>> obs1, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T2>?>> obs2, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T3>?>> obs3, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T4>?>> obs4, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T5>?>> obs5, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T6>?>> obs6, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T7>?>> obs7, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T8>?>> obs8, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T9>?>> obs9, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T10>?>> obs10, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T11>?>> obs11, System.Linq.Expressions.Expression<System.Func<TSender, System.IObservable<T12>?>> obs12, System.Func<T1?, T2?, T3?, T4?, T5?, T6?, T7?, T8?, T9?, T10?, T11?, T12?, TRet> selector)
where TSender : class { }
}
}
}
9 changes: 3 additions & 6 deletions src/ReactiveUI/Mixins/DependencyResolverMixins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,9 @@ private static void RegisterType(IMutableDependencyResolver resolver, TypeInfo t
private static Func<object> TypeFactory(TypeInfo typeInfo)
{
var parameterlessConstructor = typeInfo.DeclaredConstructors.FirstOrDefault(ci => ci.IsPublic && ci.GetParameters().Length == 0);
if (parameterlessConstructor is null)
{
throw new Exception($"Failed to register type {typeInfo.FullName} because it's missing a parameterless constructor.");
}

return Expression.Lambda<Func<object>>(Expression.New(parameterlessConstructor)).Compile();
return parameterlessConstructor is null
? throw new Exception($"Failed to register type {typeInfo.FullName} because it's missing a parameterless constructor.")
: Expression.Lambda<Func<object>>(Expression.New(parameterlessConstructor)).Compile();
}

private static void ProcessRegistrationForNamespace(string namespaceName, AssemblyName assemblyName, IMutableDependencyResolver resolver)
Expand Down
Loading