Fixes #4162. Keyword dynamic isn't AOT-Compatible and must be removed (#4163)

This commit is contained in:
BDisp
2025-06-15 17:57:55 +01:00
committed by GitHub
parent 6e486c718e
commit b50a8fd665
4 changed files with 106 additions and 32 deletions

View File

@@ -252,7 +252,7 @@ internal class NumericUpDownEditor<T> : View where T : notnull
{
X = Pos.Center (),
Y = Pos.Bottom (_increment) + 1,
Increment = (dynamic)1,
Increment = NumericUpDown<int>.TryConvert (1, out T? increment) ? increment : default,
};
_numericUpDown.ValueChanged += NumericUpDownOnValueChanged;

View File

@@ -410,7 +410,7 @@ public class TextAlignmentAndDirection : Scenario
// Save Alignment in Data
foreach (View t in multiLineLabels)
{
t.Data = new { h = t.TextAlignment, v = t.VerticalTextAlignment };
t.Data = new TextAlignmentData (t.TextAlignment, t.VerticalTextAlignment);
}
container.Add (txtLabelTL);
@@ -594,8 +594,9 @@ public class TextAlignmentAndDirection : Scenario
foreach (View t in multiLineLabels)
{
t.TextAlignment = (Alignment)((dynamic)t.Data).h;
t.VerticalTextAlignment = (Alignment)((dynamic)t.Data).v;
var data = (TextAlignmentData)t.Data;
t.TextAlignment = data!.h;
t.VerticalTextAlignment = data.v;
}
}
else
@@ -607,24 +608,23 @@ public class TextAlignmentAndDirection : Scenario
justifyOptions.Enabled = true;
}
var data = (TextAlignmentData)t.Data;
if (TextFormatter.IsVerticalDirection (t.TextDirection))
{
switch (justifyOptions.SelectedItem)
{
case 0:
t.VerticalTextAlignment = Alignment.Fill;
t.TextAlignment = ((dynamic)t.Data).h;
t.TextAlignment = data!.h;
break;
case 1:
t.VerticalTextAlignment = (Alignment)((dynamic)t.Data).v;
t.VerticalTextAlignment = data!.v;
t.TextAlignment = Alignment.Fill;
break;
case 2:
t.VerticalTextAlignment = Alignment.Fill;
t.TextAlignment = Alignment.Fill;
break;
}
}
@@ -634,18 +634,15 @@ public class TextAlignmentAndDirection : Scenario
{
case 0:
t.TextAlignment = Alignment.Fill;
t.VerticalTextAlignment = ((dynamic)t.Data).v;
t.VerticalTextAlignment = data!.v;
break;
case 1:
t.TextAlignment = (Alignment)((dynamic)t.Data).h;
t.TextAlignment = data!.h;
t.VerticalTextAlignment = Alignment.Fill;
break;
case 2:
t.TextAlignment = Alignment.Fill;
t.VerticalTextAlignment = Alignment.Fill;
break;
}
}
@@ -653,4 +650,10 @@ public class TextAlignmentAndDirection : Scenario
}
}
}
private class TextAlignmentData (Alignment h, Alignment v)
{
public Alignment h { get; } = h;
public Alignment v { get; } = v;
}
}