WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0c72fbd

Browse files
authored
Merge pull request #162 from reactivemarbles/UpdateSourceGeneratorsFixNullabilityWarnings
Update Source Generators fix nullable warnings
2 parents afce1de + 59bbe55 commit 0c72fbd

File tree

12 files changed

+39
-48
lines changed

12 files changed

+39
-48
lines changed

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<LangVersion>preview</LangVersion>
1111
<Configuration>$(TargetFramework)</Configuration>
1212
<Company>ChrisPulman</Company>
13-
<NoWarn>CS1591;IDE0190;IDE1006</NoWarn>
13+
<NoWarn>CS1591;CS1701;IDE0190;IDE1006</NoWarn>
1414
<Nullable>enable</Nullable>
1515
<PackageIcon>CrissCross.png</PackageIcon>
1616
<PackageReadmeFile>README.md</PackageReadmeFile>
@@ -55,7 +55,7 @@
5555
<!--<Compile Update="**\*.cs" DependentUpon="I%(Filename).cs" />-->
5656
<PackageReference Include="Nerdbank.GitVersioning" Version="3.7.115" PrivateAssets="all" Condition="!Exists('packages.config')" />
5757
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
58-
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10" PrivateAssets="All" />
58+
<PackageReference Include="Roslynator.Analyzers" Version="4.12.11" PrivateAssets="All" />
5959
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
6060
</ItemGroup>
6161
</Project>

src/CrissCross.Avalonia.Test.Desktop/CrissCross.Avalonia.Test.Desktop.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<OutputType>WinExe</OutputType>
44
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
5-
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
5+
One for Windows with net8.0-windows TFM, one for MacOS with net8.0-macos and one with net8.0 TFM for Linux.-->
66
<TargetFramework>net8.0</TargetFramework>
77
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
88
<ApplicationManifest>app.manifest</ApplicationManifest>

src/CrissCross.Avalonia/NavigationUserControl{TViewModel}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace CrissCross.Avalonia;
1212
/// NavigationUserControl.
1313
/// </summary>
1414
/// <typeparam name="TViewModel">The type of the view model.</typeparam>
15-
/// <seealso cref="CrissCross.Avalonia.NavigationUserControl" />
16-
/// <seealso cref="ReactiveUI.IViewFor&lt;TViewModel&gt;" />
15+
/// <seealso cref="NavigationUserControl" />
16+
/// <seealso cref="IViewFor&lt;TViewModel&gt;" />
1717
public class NavigationUserControl<TViewModel> : NavigationUserControl, IViewFor<TViewModel>
1818
where TViewModel : class, IRxObject, new()
1919
{

src/CrissCross.Avalonia/ReactiveTransitioningContentControl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class ReactiveTransitioningContentControl : ContentControl, ICancelable
2323
{
2424
private readonly Subject<double> _opacitySubject = new();
2525
private readonly SemaphoreSlim _animationSemaphore = new(1);
26-
private CompositeDisposable _animationDisposable = new();
26+
private CompositeDisposable _animationDisposable = [];
2727
private ContentPresenter? _contentPresenter2;
2828
private ContentPresenter? _contentPresenter1;
2929
private int _currentPresenter;
@@ -121,9 +121,9 @@ private void AnimateContent()
121121
{
122122
// This should be an animation but there is currently an issue with PageTransitions in Avalonia
123123
_animationDisposable.Dispose();
124-
_animationDisposable = new();
124+
_animationDisposable = [];
125125
var (from, to, current) = GetPresenters();
126-
to!.Bind(ContentPresenter.OpacityProperty, _opacitySubject).DisposeWith(_animationDisposable);
126+
to!.Bind(OpacityProperty, _opacitySubject).DisposeWith(_animationDisposable);
127127
var opacity = 0d;
128128
Observable.Interval(TimeSpan.FromMilliseconds(10)).Subscribe(_ =>
129129
{

src/CrissCross.WPF.Plot/CrissCross.WPF.Plot.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="AppBarButton.WPF" Version="1.0.2" />
16-
<PackageReference Include="ReactiveList" Version="2.1.0" />
16+
<PackageReference Include="ReactiveList" Version="2.2.0" />
1717
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
18-
<PackageReference Include="ReactiveUI.SourceGenerators" Version="2.0.17" PrivateAssets="all" />
18+
<PackageReference Include="ReactiveUI.SourceGenerators" Version="2.1.1" PrivateAssets="all" />
1919
<PackageReference Include="ScottPlot.WPF" Version="5.0.54" />
2020
<PackageReference Include="System.Text.Json" Version="9.0.1" />
2121
</ItemGroup>

src/CrissCross.WPF.Plot/Live/Settings.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
namespace CrissCross.WPF.Plot;
1111

1212
/// <summary>
13-
/// EquationData.
13+
/// Settings.
1414
/// </summary>
1515
/// <seealso cref="Settings" />
1616
/// <remarks>
1717
/// Initializes a new instance of the <see cref="Settings" /> class.
1818
/// </remarks>
19-
/// <param name="itemName">itemName.</param>
2019
public partial class Settings : RxObject, IAppearance
2120
{
2221
/// <summary>
@@ -41,7 +40,7 @@ public partial class Settings : RxObject, IAppearance
4140
/// The color CheckBox.
4241
/// </value>
4342
[Reactive]
44-
private string _color;
43+
private string? _color;
4544

4645
/// <summary>
4746
/// Gets or sets the color text.
@@ -50,7 +49,7 @@ public partial class Settings : RxObject, IAppearance
5049
/// The color text.
5150
/// </value>
5251
[Reactive]
53-
private string _colorText;
52+
private string? _colorText;
5453

5554
/// <summary>
5655
/// Gets or sets the displayed value.
@@ -95,7 +94,7 @@ public partial class Settings : RxObject, IAppearance
9594
/// <c>true</c> if this instance is visible; otherwise, <c>false</c>.
9695
/// </value>
9796
[Reactive]
98-
private string _visibility;
97+
private string? _visibility;
9998

10099
/// <summary>
101100
/// Gets or sets the name of the item.
@@ -104,7 +103,7 @@ public partial class Settings : RxObject, IAppearance
104103
/// The name of the item.
105104
/// </value>
106105
[Reactive]
107-
private string _itemName;
106+
private string? _itemName;
108107

109108
/// <summary>
110109
/// Gets or sets the width of the line.

src/CrissCross.WPF.UI.Gallery/CrissCross.WPF.UI.Gallery.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>
19-
<PackageReference Include="ReactiveUI.SourceGenerators" Version="2.0.17" PrivateAssets="all" />
19+
<PackageReference Include="ReactiveUI.SourceGenerators" Version="2.1.1" PrivateAssets="all" />
2020
<PackageReference Include="CompiledBindings.WPF" Version="1.0.18" />
2121
</ItemGroup>
2222

src/CrissCross.WPF.UI/Controls/GifImage/CancellationExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ public static Task WhenCanceled(this CancellationToken cancellationToken)
2929
registration = cancellationToken.Register(
3030
o =>
3131
{
32-
((TaskCompletionSource<int>)o).TrySetCanceled();
32+
if (o is TaskCompletionSource<int> tcs)
33+
{
34+
tcs.TrySetCanceled();
35+
}
3336

3437
// ReSharper disable once AccessToModifiedClosure
3538
registration.Dispose();

src/CrissCross.WPF.UI/Controls/GifImage/Decompression/LzwDecompressStream.cs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,21 @@ internal class LzwDecompressStream(byte[] compressedBuffer, int minimumCodeLengt
2121

2222
public override bool CanWrite => true;
2323

24-
public override long Length
25-
{
26-
get { throw new NotSupportedException(); }
27-
}
24+
public override long Length => throw new NotSupportedException();
2825

2926
public override long Position
3027
{
31-
get { throw new NotSupportedException(); }
32-
set { throw new NotSupportedException(); }
28+
get => throw new NotSupportedException();
29+
set => throw new NotSupportedException();
3330
}
3431

3532
public override void Flush()
3633
{
3734
}
3835

39-
public override long Seek(long offset, SeekOrigin origin)
40-
{
41-
throw new NotSupportedException();
42-
}
36+
public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();
4337

44-
public override void SetLength(long value)
45-
{
46-
throw new NotSupportedException();
47-
}
38+
public override void SetLength(long value) => throw new NotSupportedException();
4839

4940
public override int Read(byte[] buffer, int offset, int count)
5041
{
@@ -73,17 +64,14 @@ public override int Read(byte[] buffer, int offset, int count)
7364
return read;
7465
}
7566

76-
public override void Write(byte[] buffer, int offset, int count)
77-
{
78-
throw new NotSupportedException();
79-
}
67+
public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException();
8068

81-
private static byte[] CopySequenceToBuffer(byte[] sequence, byte[] buffer, int offset, int count, ref int read)
69+
private static byte[]? CopySequenceToBuffer(byte[]? sequence, byte[] buffer, int offset, int count, ref int read)
8270
{
83-
var bytesToRead = Math.Min(sequence.Length, count - read);
71+
var bytesToRead = Math.Min(sequence!.Length, count - read);
8472
Buffer.BlockCopy(sequence, 0, buffer, offset + read, bytesToRead);
8573
read += bytesToRead;
86-
byte[] remainingBytes = null;
74+
byte[]? remainingBytes = null;
8775
if (bytesToRead < sequence.Length)
8876
{
8977
var remainingBytesCount = sequence.Length - bytesToRead;
@@ -153,14 +141,14 @@ private bool ProcessCode(int code, byte[] buffer, int offset, int count, ref int
153141
if (_prevCode >= 0)
154142
{
155143
var prev = _codeTable[_prevCode];
156-
var newSequence = prev.Append(sequence.Bytes[0]);
144+
var newSequence = prev.Append(sequence.Bytes![0]);
157145
_codeTable.Add(newSequence);
158146
}
159147
}
160148
else
161149
{
162150
var prev = _codeTable[_prevCode];
163-
var newSequence = prev.Append(prev.Bytes[0]);
151+
var newSequence = prev.Append(prev.Bytes![0]);
164152
_codeTable.Add(newSequence);
165153
_remainingBytes = CopySequenceToBuffer(newSequence.Bytes, buffer, offset, count, ref read);
166154
}
@@ -193,7 +181,7 @@ private Sequence(bool isClearCode, bool isStopCode)
193181

194182
public Sequence Append(byte b)
195183
{
196-
var bytes = new byte[Bytes.Length + 1];
184+
var bytes = new byte[Bytes!.Length + 1];
197185
Bytes.CopyTo(bytes, 0);
198186
bytes[Bytes.Length] = b;
199187
return new Sequence(bytes);

src/CrissCross.WPF.UI/Controls/PersonPicture/Strings/Resources.ar-SA.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@
150150
<comment>This text is used to show the number of items in the person picture badging area, when that number is 1. {0} is the contact name and {1} is the number of items.</comment>
151151
</data>
152152
<data name="BadgeItemTextOverride" xml:space="preserve">
153-
<value>{0} ، {1:d} {2}</value>
153+
<value>{0}، {1:d} {2}</value>
154154
<comment>This format string is used for the automation name. It is 'Person Name, badgenumber badgetext', where badge text is a user specified string overriding 'item(s)'.</comment>
155155
</data>
156156
<data name="BadgeIcon" xml:space="preserve">
157-
<value>رمز {0}،</value>
157+
<value>{0}، رمز </value>
158158
<comment>This text is used with the badging glyph. {0} is the contact name.</comment>
159159
</data>
160160
<data name="BadgeIconTextOverride" xml:space="preserve">

0 commit comments

Comments
 (0)