Skip to content

Commit

Permalink
ci: Adjust for warnings as errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 29, 2022
1 parent f040b1d commit 035df68
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 17 deletions.
4 changes: 3 additions & 1 deletion src/Uno.UI/UI/Xaml/Documents/Hyperlink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
namespace Windows.UI.Xaml.Documents
{
public sealed partial class Hyperlink : Span
{
{
#pragma warning disable CS0649 // error CS0649: Field '_focusableHelper' is never assigned to, and will always have its default value null
private readonly IFocusable _focusableHelper;
#pragma warning restore CS0649 // error CS0649: Field '_focusableHelper' is never assigned to, and will always have its default value null

#region Static
private static Brush _defaultForeground;
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Documents/Hyperlink.mux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Windows.UI.Xaml.Documents
{
public partial class Hyperlink
{
internal bool IsFocusable()
internal new bool IsFocusable()
{
var element = GetContainingFrameworkElement();
return
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.UI/UI/Xaml/DragDrop/DragDropExtension.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ IEnumerable<string> GetModifiers(DragDropExtensionEventArgs that)
[DataContract]
private struct DataEntry
{
#pragma warning disable CS0649 // error CS0649: Field 'DragDropExtension.DataEntry.kind' is never assigned to, and will always have its default value null
[DataMember]
public int id;

Expand All @@ -485,6 +486,7 @@ private struct DataEntry

[DataMember]
public string type;
#pragma warning restore CS0649 // error CS0649: Field 'DragDropExtension.DataEntry.kind' is never assigned to, and will always have its default value null

/// <inheritdoc />
public override string ToString()
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/FontFamily.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static bool TryGetExternalUri(string? source, out Uri? uri)
if (!uri.IsAbsoluteUri || source.StartsWith("/"))
{
// Support for implicit ms-appx resolution
var assetUri = AssetsPathBuilder.BuildAssetUri(Uri.EscapeUriString(source.TrimStart('/')));
var assetUri = AssetsPathBuilder.BuildAssetUri(Uri.EscapeDataString(source.TrimStart('/')));
uri = new Uri(assetUri, UriKind.RelativeOrAbsolute);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/FrameworkElement.Interface.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public FrameworkElement(string htmlTag, bool isSvg) : base(htmlTag, isSvg)
_logDebug = _log.IsEnabled(LogLevel.Debug) ? _log : null;
}

private protected readonly Logger _log;
private protected readonly Logger _logDebug;
private new protected readonly Logger _log;
private new protected readonly Logger _logDebug;

private static readonly Uri DefaultBaseUri = new Uri("ms-appx://local");
public global::System.Uri BaseUri { get; internal set; } = DefaultBaseUri;
Expand Down
1 change: 1 addition & 0 deletions src/Uno.UI/UI/Xaml/IFrameworkElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
using ObjCRuntime;
#endif
#elif __WASM__
#pragma warning disable CS8981 // The type name 'nint' only contains lower-cased ascii characters. Such names may become reserved for the language
using nint = System.Int32;
using nfloat = System.Double;
using Point = Windows.Foundation.Point;
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.Pointers.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private static PointerRoutedEventArgs ToPointerArgs(
}
#endregion

partial void OnManipulationModeChanged(ManipulationModes _, ManipulationModes newMode)
partial void OnManipulationModeChanged(ManipulationModes oldMode, ManipulationModes newMode)
{
if (newMode is ManipulationModes.None or ManipulationModes.System)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/UIElement.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,12 @@ public Rect Arranged

public Func<Size, Size> DesiredSizeSelector { get; set; }

partial void OnVisibilityChangedPartial(Visibility oldValue, Visibility newVisibility)
partial void OnVisibilityChangedPartial(Visibility oldValue, Visibility newValue)
{
InvalidateMeasure();
UpdateHitTest();

WindowManagerInterop.SetVisibility(HtmlId, newVisibility == Visibility.Visible);
WindowManagerInterop.SetVisibility(HtmlId, newValue == Visibility.Visible);

if (FeatureConfiguration.UIElement.AssignDOMXamlProperties)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/VisualStateManager.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private static void TryAssignDOMVisualStates(IList<VisualStateGroup> groups, IFr
if (Uno.UI.FeatureConfiguration.UIElement.AssignDOMXamlProperties)
{
var sb = new StringBuilder();
sb.Append("[");
sb.Append('[');
foreach (var group in groups)
{
sb.Append($"{group}: {group.CurrentState}, ");
Expand Down
1 change: 1 addition & 0 deletions src/Uno.UI/Uno.UI.Wasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<RootNamespace>Uno.UI</RootNamespace>
<AssemblyName>Uno.UI</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<TSBindingsPath>$(MSBuildThisFileDirectory)tsBindings</TSBindingsPath>
<TSBindingAssemblySource>Uno;Uno.UI</TSBindingAssemblySource>
Expand Down
4 changes: 3 additions & 1 deletion src/Uno.UWP/Collections/HashtableEx.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#nullable enable
#pragma warning disable CS8981

#nullable enable
// Based on https://github.com/dotnet/runtime/commit/bdc8e420aa75999021e06b85e2e1869962730a0f

// Licensed to the .NET Foundation under one or more agreements.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public InertiaProcessor(Manipulation owner, Point position, ManipulationDelta cu

_isTranslateInertiaXEnabled = _owner._isTranslateXEnabled
&& _owner._settings.HasFlag(Input.GestureSettings.ManipulationTranslateInertia)
&& Abs(velocities.Linear.X) > _owner._inertiaThresholds.TranslateX;
&& Math.Abs(velocities.Linear.X) > _owner._inertiaThresholds.TranslateX;
_isTranslateInertiaYEnabled = _owner._isTranslateYEnabled
&& _owner._settings.HasFlag(Input.GestureSettings.ManipulationTranslateInertia)
&& Abs(velocities.Linear.Y) > _owner._inertiaThresholds.TranslateY;
&& Math.Abs(velocities.Linear.Y) > _owner._inertiaThresholds.TranslateY;
_isRotateInertiaEnabled = _owner._isRotateEnabled
&& _owner._settings.HasFlag(Input.GestureSettings.ManipulationRotateInertia)
&& Abs(velocities.Angular) > _owner._inertiaThresholds.Rotate;
Expand Down Expand Up @@ -93,7 +93,7 @@ public void Start()
// As of 2021-07-21, according to test, Displacement takes over Deceleration.
if (!IsNaN(DesiredDisplacement))
{
var v0 = (Abs(_velocities0.Linear.X) + Abs(_velocities0.Linear.Y)) / 2;
var v0 = (Math.Abs(_velocities0.Linear.X) + Math.Abs(_velocities0.Linear.Y)) / 2;
DesiredDisplacementDeceleration = GetDecelerationFromDesiredDisplacement(v0, DesiredDisplacement);
}
if (!IsNaN(DesiredRotation))
Expand Down Expand Up @@ -184,14 +184,14 @@ private float GetValue(bool enabled, double v0, double d, double t, float lastVa
// https://docs.microsoft.com/en-us/windows/win32/wintouch/inertia-mechanics#inertia-physics-overview
private float GetValue(double v0, double d, double t)
=> v0 >= 0
? (float)(v0 * t - d * Pow(t, 2))
: -(float)(-v0 * t - d * Pow(t, 2));
? (float)(v0 * t - d * Math.Pow(t, 2))
: -(float)(-v0 * t - d * Math.Pow(t, 2));

private bool IsCompleted(double v0, double d, double t)
=> Abs(v0) - d * 2 * t <= 0; // The derivative of the GetValue function
=> Math.Abs(v0) - d * 2 * t <= 0; // The derivative of the GetValue function

private double GetDecelerationFromDesiredDisplacement(double v0, double displacement, double durationMs = _defaultDurationMs)
=> (v0 * durationMs - displacement) / Pow(_defaultDurationMs, 2);
=> (v0 * durationMs - displacement) / Math.Pow(_defaultDurationMs, 2);

/// <inheritdoc />
public void Dispose()
Expand Down

0 comments on commit 035df68

Please sign in to comment.