diff --git a/.gitignore b/.gitignore
index 99f085cf50..e2b23118e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,4 +61,10 @@ demo.*
logs/
-log.*
\ No newline at end of file
+BenchmarkDotNet.Artifacts/
+
+*.log
+
+*.log.*
+
+log.*
diff --git a/Terminal.Gui/Application/Application.Initialization.cs b/Terminal.Gui/Application/Application.Initialization.cs
index a74f1545d1..d23f4f49c8 100644
--- a/Terminal.Gui/Application/Application.Initialization.cs
+++ b/Terminal.Gui/Application/Application.Initialization.cs
@@ -167,6 +167,8 @@ internal static void InternalInit (
InitializedChanged?.Invoke (null, new (init));
}
+ [RequiresUnreferencedCode ("AOT")]
+ [RequiresDynamicCode ("AOT")]
internal static void InitializeConfigurationManagement ()
{
// Start the process of configuration management.
diff --git a/Terminal.Gui/Configuration/ConfigurationManager.cs b/Terminal.Gui/Configuration/ConfigurationManager.cs
index 2326c028ec..b2b5f47664 100644
--- a/Terminal.Gui/Configuration/ConfigurationManager.cs
+++ b/Terminal.Gui/Configuration/ConfigurationManager.cs
@@ -327,16 +327,16 @@ public static void PrintJsonErrors ()
///
- /// Logs any Json deserialization errors that occurred during deserialization to the logging system.
+ /// Logs Json deserialization errors that occurred during deserialization.
///
public static void LogJsonErrors ()
{
if (_jsonErrors.Length > 0)
{
- Logging.Warning (
+ Logging.Error (
@"Encountered the following errors while deserializing configuration files:"
);
- Logging.Warning (_jsonErrors.ToString ());
+ Logging.Error (_jsonErrors.ToString ());
}
}
diff --git a/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/Keyboard/CsiKeyPattern.cs b/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/Keyboard/CsiKeyPattern.cs
index cdcd10a598..6fb6a6e75b 100644
--- a/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/Keyboard/CsiKeyPattern.cs
+++ b/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/Keyboard/CsiKeyPattern.cs
@@ -53,7 +53,7 @@ public CsiKeyPattern ()
}
///
- ///
+ /// Called by the base class to determine the key that matches the input.
///
///
///
diff --git a/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs b/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs
index 08575a1ba3..d4bd54863a 100644
--- a/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs
+++ b/Terminal.Gui/ConsoleDrivers/V2/MainLoop.cs
@@ -151,7 +151,7 @@ internal void IterationImpl ()
private void SetCursor ()
{
- View? mostFocused = Application.Top.MostFocused;
+ View? mostFocused = Application.Top!.MostFocused;
if (mostFocused == null)
{
diff --git a/Terminal.Gui/ConsoleDrivers/V2/NetInputProcessor.cs b/Terminal.Gui/ConsoleDrivers/V2/NetInputProcessor.cs
index d08daca5f4..e507c97f66 100644
--- a/Terminal.Gui/ConsoleDrivers/V2/NetInputProcessor.cs
+++ b/Terminal.Gui/ConsoleDrivers/V2/NetInputProcessor.cs
@@ -17,7 +17,7 @@ public class NetInputProcessor : InputProcessor
///
///
public static bool GenerateTestCasesForKeyPresses = false;
-#pragma warning enable CA2211
+#pragma warning restore CA2211
///
public NetInputProcessor (ConcurrentQueue inputBuffer) : base (inputBuffer, new NetKeyConverter ()) { }
diff --git a/Terminal.Gui/Drawing/Region.cs b/Terminal.Gui/Drawing/Region.cs
index a5b144f212..2e51319758 100644
--- a/Terminal.Gui/Drawing/Region.cs
+++ b/Terminal.Gui/Drawing/Region.cs
@@ -658,7 +658,7 @@ internal static List MergeVerticalIntervals (SortedSet<(int yTop, int
}
else
{
- result.Add (new (startX, currentTop.Value, endX - startX, currentBottom.Value - currentTop.Value));
+ result.Add (new (startX, currentTop.Value, endX - startX, currentBottom!.Value - currentTop.Value));
currentTop = yTop;
currentBottom = yBottom;
}
diff --git a/Terminal.Gui/Input/Keyboard/Key.cs b/Terminal.Gui/Input/Keyboard/Key.cs
index 53d6292756..e0d4119aa3 100644
--- a/Terminal.Gui/Input/Keyboard/Key.cs
+++ b/Terminal.Gui/Input/Keyboard/Key.cs
@@ -418,7 +418,7 @@ public override bool Equals (object? obj)
///
///
///
- public static bool operator != (Key a, Key? b) { return !a!.Equals (b); }
+ public static bool operator != (Key? a, Key? b) { return !a!.Equals (b); }
/// Compares two s for less-than.
///
diff --git a/Terminal.Gui/View/View.Content.cs b/Terminal.Gui/View/View.Content.cs
index b187e01407..418f123c28 100644
--- a/Terminal.Gui/View/View.Content.cs
+++ b/Terminal.Gui/View/View.Content.cs
@@ -264,7 +264,7 @@ public ViewportSettings ViewportSettings
///
///
/// Altering the Viewport Size will eventually (when the view is next laid out) cause the
- /// and methods to be called.
+ /// and methods to be called.
///
///
public virtual Rectangle Viewport
diff --git a/Terminal.Gui/View/View.Drawing.cs b/Terminal.Gui/View/View.Drawing.cs
index aa77e3f05a..11887b9df0 100644
--- a/Terminal.Gui/View/View.Drawing.cs
+++ b/Terminal.Gui/View/View.Drawing.cs
@@ -483,6 +483,7 @@ private void DoDrawContent (DrawContext? context = null)
return;
}
+ // TODO: Upgrade all overrides of OnDrawingContent to use DrawContext and remove this override
if (OnDrawingContent ())
{
return;
@@ -504,7 +505,7 @@ private void DoDrawContent (DrawContext? context = null)
///
/// The draw context to report drawn areas to.
/// to stop further drawing content.
- protected virtual bool OnDrawingContent (DrawContext? context = null) { return false; }
+ protected virtual bool OnDrawingContent (DrawContext? context) { return false; }
///
/// Called when the View's content is to be drawn. The default implementation does nothing.
diff --git a/Terminal.Gui/View/View.Mouse.cs b/Terminal.Gui/View/View.Mouse.cs
index 3c5b0d01a3..bdce9b5e29 100644
--- a/Terminal.Gui/View/View.Mouse.cs
+++ b/Terminal.Gui/View/View.Mouse.cs
@@ -762,7 +762,7 @@ internal bool SetPressedHighlight (HighlightStyle newHighlightStyle)
/// INTERNAL: Gets the Views that are under the mouse at , including Adornments.
///
///
- ///
+ /// If any transparent views will be ignored.
///
internal static List GetViewsUnderMouse (in Point location, bool ignoreTransparent = false)
{
diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs
index 3b9d9aeac0..015157dc69 100644
--- a/Terminal.Gui/Views/RadioGroup.cs
+++ b/Terminal.Gui/Views/RadioGroup.cs
@@ -411,6 +411,8 @@ public Orientation Orientation
public event EventHandler>? OrientationChanged;
#pragma warning restore CS0067 // The event is never used
+#pragma warning restore CS0067
+
/// Called when has changed.
///
public void OnOrientationChanged (Orientation newOrientation)
diff --git a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs
index 62d60320da..44b50fb09a 100644
--- a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs
+++ b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs
@@ -167,6 +167,7 @@ public Orientation Orientation
#pragma warning disable CS0067 // The event is never used
///
public event EventHandler>? OrientationChanging;
+#pragma warning restore CS0067 // The event is never used
///
public event EventHandler>? OrientationChanged;
diff --git a/UICatalog/Scenario.cs b/UICatalog/Scenario.cs
index e45e269f7d..860ef27207 100644
--- a/UICatalog/Scenario.cs
+++ b/UICatalog/Scenario.cs
@@ -149,7 +149,7 @@ public static ObservableCollection GetScenarios ()
public virtual void Main () { }
private const uint BENCHMARK_MAX_NATURAL_ITERATIONS = 500; // not including needed for demo keys
- private const int BENCHMARK_KEY_PACING = 1; // Must be non-zero
+ private const int BENCHMARK_KEY_PACING = 10; // Must be non-zero
public static uint BenchmarkTimeout { get; set; } = 2500;
diff --git a/UICatalog/Scenarios/RegionScenario.cs b/UICatalog/Scenarios/RegionScenario.cs
index 9b2e29c1a0..2eb64d945d 100644
--- a/UICatalog/Scenarios/RegionScenario.cs
+++ b/UICatalog/Scenarios/RegionScenario.cs
@@ -19,10 +19,7 @@ public class RegionScenario : Scenario
private Point? _dragStart;
private bool _isDragging;
-
- public Rune? _previewFillRune = Glyphs.Stipple;
-
- public Rune? _fillRune = Glyphs.Dot;
+ private readonly Rune? _previewFillRune = Glyphs.Stipple;
private RegionDrawStyles _drawStyle;
private RegionOp _regionOp;
@@ -34,25 +31,22 @@ public override void Main ()
Window app = new ()
{
Title = GetQuitKeyAndName (),
- TabStop = TabBehavior.TabGroup,
-
+ TabStop = TabBehavior.TabGroup
};
- app.Padding.Thickness = new (1);
+ app.Padding!.Thickness = new (1);
var tools = new ToolsView { Title = "Tools", X = Pos.AnchorEnd (), Y = 2 };
- tools.CurrentAttribute = app.ColorScheme.HotNormal;
+ tools.CurrentAttribute = app.ColorScheme!.HotNormal;
tools.SetStyle += b =>
{
_drawStyle = (RegionDrawStyles)b;
- app.SetNeedsDraw();
+ app.SetNeedsDraw ();
};
- tools.RegionOpChanged += (s, e) =>
- {
- _regionOp = e;
- };
+ tools.RegionOpChanged += (s, e) => { _regionOp = e; };
+
//tools.AddLayer += () => canvas.AddLayer ();
app.Add (tools);
@@ -87,7 +81,7 @@ public override void Main ()
_dragStart = null;
}
- app.SetNeedsDraw ();
+ app.SetNeedsDraw ();
}
};
@@ -120,12 +114,17 @@ public override void Main ()
if (_isDragging && _dragStart.HasValue)
{
Point currentMousePos = Application.GetLastMousePosition ()!.Value;
- var previewRect = GetRectFromPoints (_dragStart.Value, currentMousePos);
+ Rectangle previewRect = GetRectFromPoints (_dragStart.Value, currentMousePos);
var previewRegion = new Region (previewRect);
previewRegion.FillRectangles (tools.CurrentAttribute!.Value, (Rune)' ');
- previewRegion.DrawBoundaries (app.LineCanvas, LineStyle.Dashed, new (tools.CurrentAttribute!.Value.Foreground.GetHighlightColor(), tools.CurrentAttribute!.Value.Background));
+ previewRegion.DrawBoundaries (
+ app.LineCanvas,
+ LineStyle.Dashed,
+ new (
+ tools.CurrentAttribute!.Value.Foreground.GetHighlightColor (),
+ tools.CurrentAttribute!.Value.Background));
}
};
@@ -138,7 +137,7 @@ public override void Main ()
private void AddRectangleFromPoints (Point start, Point end, RegionOp op)
{
- var rect = GetRectFromPoints (start, end);
+ Rectangle rect = GetRectFromPoints (start, end);
var region = new Region (rect);
_region.Combine (region, op); // Or RegionOp.MinimalUnion if you want minimal rectangles
}
@@ -154,7 +153,7 @@ private Rectangle GetRectFromPoints (Point start, Point end)
int width = Math.Max (1, right - left + 1);
int height = Math.Max (1, bottom - top + 1);
- return new Rectangle (left, top, width, height);
+ return new (left, top, width, height);
}
}
@@ -165,15 +164,14 @@ public enum RegionDrawStyles
InnerBoundaries = 1,
OuterBoundary = 2
-
}
public class ToolsView : Window
{
//private Button _addLayerBtn;
private readonly AttributeView _attributeView = new ();
- private RadioGroup _stylePicker;
- private RegionOpSelector _regionOpSelector;
+ private RadioGroup? _stylePicker;
+ private RegionOpSelector? _regionOpSelector;
public Attribute? CurrentAttribute
{
@@ -187,7 +185,6 @@ public ToolsView ()
Border!.Thickness = new (1, 2, 1, 1);
Height = Dim.Auto ();
Width = Dim.Auto ();
-
}
//public event Action AddLayer;
@@ -200,11 +197,11 @@ public override void BeginInit ()
_stylePicker = new ()
{
- Width=Dim.Fill(),
- X = 0, Y = Pos.Bottom (_attributeView) + 1, RadioLabels = Enum.GetNames ().Select (n => n = "_" + n).ToArray()
+ Width = Dim.Fill (),
+ X = 0, Y = Pos.Bottom (_attributeView) + 1, RadioLabels = Enum.GetNames ().Select (n => n = "_" + n).ToArray ()
};
_stylePicker.BorderStyle = LineStyle.Single;
- _stylePicker.Border.Thickness = new (0, 1, 0, 0);
+ _stylePicker.Border!.Thickness = new (0, 1, 0, 0);
_stylePicker.Title = "Draw Style";
_stylePicker.SelectedItemChanged += (s, a) => { SetStyle?.Invoke ((LineStyle)a.SelectedItem); };
@@ -221,7 +218,7 @@ public override void BeginInit ()
//_addLayerBtn = new () { Text = "New Layer", X = Pos.Center (), Y = Pos.Bottom (_stylePicker) };
//_addLayerBtn.Accepting += (s, a) => AddLayer?.Invoke ();
- Add (_attributeView, _stylePicker, _regionOpSelector);//, _addLayerBtn);
+ Add (_attributeView, _stylePicker, _regionOpSelector); //, _addLayerBtn);
}
public event EventHandler? AttributeChanged;
@@ -231,14 +228,15 @@ public override void BeginInit ()
public class RegionOpSelector : View
{
- private RadioGroup _radioGroup;
+ private readonly RadioGroup _radioGroup;
+
public RegionOpSelector ()
{
Width = Dim.Auto ();
Height = Dim.Auto ();
BorderStyle = LineStyle.Single;
- Border.Thickness = new (0, 1, 0, 0);
+ Border!.Thickness = new (0, 1, 0, 0);
Title = "RegionOp";
_radioGroup = new ()
@@ -250,14 +248,14 @@ public RegionOpSelector ()
_radioGroup.SelectedItemChanged += (s, a) => { SelectedItemChanged?.Invoke (this, (RegionOp)a.SelectedItem); };
Add (_radioGroup);
}
+
public event EventHandler? SelectedItemChanged;
public RegionOp SelectedItem
{
get => (RegionOp)_radioGroup.SelectedItem;
- set => _radioGroup.SelectedItem = (int) value;
+ set => _radioGroup.SelectedItem = (int)value;
}
-
}
public class AttributeView : View
@@ -289,11 +287,11 @@ public Attribute? Value
public AttributeView ()
{
- Width = Dim.Fill();
+ Width = Dim.Fill ();
Height = 4;
BorderStyle = LineStyle.Single;
- Border.Thickness = new (0, 1, 0, 0);
+ Border!.Thickness = new (0, 1, 0, 0);
Title = "Attribute";
}
@@ -366,8 +364,8 @@ protected override bool OnMouseEvent (MouseEventArgs mouseEvent)
{
ClickedInBackground ();
}
-
}
+
mouseEvent.Handled = true;
return mouseEvent.Handled;
@@ -394,4 +392,4 @@ private void ClickedInForeground ()
SetNeedsDraw ();
}
}
-}
\ No newline at end of file
+}
diff --git a/UICatalog/Scenarios/Transparent.cs b/UICatalog/Scenarios/Transparent.cs
index f2790cbc57..5841ed90fa 100644
--- a/UICatalog/Scenarios/Transparent.cs
+++ b/UICatalog/Scenarios/Transparent.cs
@@ -87,7 +87,7 @@ public TransparentView ()
Arrangement = ViewArrangement.Movable | ViewArrangement.Resizable,
ShadowStyle = ShadowStyle.Transparent,
};
- transparentSubView.Border.Thickness = new (1, 1, 1, 1);
+ transparentSubView.Border!.Thickness = new (1, 1, 1, 1);
transparentSubView.ColorScheme = Colors.ColorSchemes ["Dialog"];
Button button = new Button ()
diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs
index e661097d60..29e17f7320 100644
--- a/UICatalog/UICatalog.cs
+++ b/UICatalog/UICatalog.cs
@@ -1308,14 +1308,14 @@ private List