Skip to content

Commit 5b21a99

Browse files
authored
Merge branch 'main' into allow-ref-structs
2 parents ab519ac + 67c676c commit 5b21a99

45 files changed

Lines changed: 680 additions & 132 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
# The version of .NET to use just for NuGet package operations.
2525
# This doesn't have to be exactly in sync with the .NET SDK
2626
# version defined in 'global.json', as it's not used for builds.
27-
DOTNET_NUGET_VERSION: ${{ '9.0.x' }}
27+
DOTNET_NUGET_VERSION: ${{ '10.0.x' }}
2828

2929
jobs:
3030

dotnet.slnx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<Solution>
2-
<Configurations>
3-
<Platform Name="Any CPU" />
4-
</Configurations>
52
<Folder Name="/Solution Items/">
63
<File Path=".editorconfig" />
74
<File Path=".gitattributes" />
@@ -40,9 +37,11 @@
4037
<Project Path="tests/CommunityToolkit.Mvvm.Roslyn4001.UnitTests/CommunityToolkit.Mvvm.Roslyn4001.UnitTests.csproj" />
4138
<Project Path="tests/CommunityToolkit.Mvvm.Roslyn4031.UnitTests/CommunityToolkit.Mvvm.Roslyn4031.UnitTests.csproj" />
4239
<Project Path="tests/CommunityToolkit.Mvvm.Roslyn4120.UnitTests/CommunityToolkit.Mvvm.Roslyn4120.UnitTests.csproj" />
40+
<Project Path="tests/CommunityToolkit.Mvvm.Roslyn5000.UnitTests/CommunityToolkit.Mvvm.Roslyn5000.UnitTests.csproj" />
4341
<Project Path="tests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4001.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4001.UnitTests.csproj" />
4442
<Project Path="tests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4031.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4031.UnitTests.csproj" />
4543
<Project Path="tests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4120.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4120.UnitTests.csproj" />
44+
<Project Path="tests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000.UnitTests.csproj" />
4645
<Project Path="tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests.shproj" />
4746
<Project Path="tests/CommunityToolkit.Mvvm.UnitTests/CommunityToolkit.Mvvm.UnitTests.shproj" />
4847
</Folder>
@@ -58,6 +57,7 @@
5857
<Project Path="src/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4001/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4001.csproj" />
5958
<Project Path="src/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4031/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4031.csproj" />
6059
<Project Path="src/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4120/CommunityToolkit.Mvvm.SourceGenerators.Roslyn4120.csproj" />
60+
<Project Path="src/CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000/CommunityToolkit.Mvvm.SourceGenerators.Roslyn5000.csproj" />
6161
<Project Path="src/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.shproj" />
6262
<Project Path="src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj" />
6363
</Solution>

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.306",
3+
"version": "10.0.101",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/CommunityToolkit.HighPerformance/Memory/Internals/OverflowHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ public static void EnsureIsInNativeIntRange(int height, int width, int pitch)
6464
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6565
public static int ComputeInt32Area(int height, int width, int pitch)
6666
{
67-
return checked(((width + pitch) * Max(unchecked(height - 1), 0)) + width);
67+
return Max(checked(((width + pitch) * (height - 1)) + width), 0);
6868
}
6969
}

src/CommunityToolkit.HighPerformance/Memory/Memory2D{T}.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,6 @@ public unsafe Memory2D(MemoryManager<T> memoryManager, int offset, int height, i
362362
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
363363
}
364364

365-
if (width == 0 || height == 0)
366-
{
367-
this = default;
368-
369-
return;
370-
}
371-
372365
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
373366
int remaining = length - offset;
374367

@@ -435,16 +428,8 @@ internal unsafe Memory2D(Memory<T> memory, int offset, int height, int width, in
435428
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
436429
}
437430

438-
if (width == 0 || height == 0)
439-
{
440-
this = default;
441-
442-
return;
443-
}
444-
445-
int
446-
area = OverflowHelper.ComputeInt32Area(height, width, pitch),
447-
remaining = memory.Length - offset;
431+
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
432+
int remaining = memory.Length - offset;
448433

449434
if (area > remaining)
450435
{

src/CommunityToolkit.HighPerformance/Memory/ReadOnlyMemory2D{T}.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,6 @@ public unsafe ReadOnlyMemory2D(MemoryManager<T> memoryManager, int offset, int h
382382
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
383383
}
384384

385-
if (width == 0 || height == 0)
386-
{
387-
this = default;
388-
389-
return;
390-
}
391-
392385
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
393386
int remaining = length - offset;
394387

@@ -455,13 +448,6 @@ internal unsafe ReadOnlyMemory2D(ReadOnlyMemory<T> memory, int offset, int heigh
455448
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
456449
}
457450

458-
if (width == 0 || height == 0)
459-
{
460-
this = default;
461-
462-
return;
463-
}
464-
465451
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
466452
int remaining = memory.Length - offset;
467453

src/CommunityToolkit.HighPerformance/Memory/ReadOnlySpan2D{T}.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ public ReadOnlySpan2D(T[] array, int offset, int height, int width, int pitch)
209209
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
210210
}
211211

212-
if (width == 0 || height == 0)
213-
{
214-
this = default;
215-
216-
return;
217-
}
218-
219212
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
220213
int remaining = array.Length - offset;
221214

@@ -459,13 +452,6 @@ internal ReadOnlySpan2D(ReadOnlySpan<T> span, int offset, int height, int width,
459452
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
460453
}
461454

462-
if (width == 0 || height == 0)
463-
{
464-
this = default;
465-
466-
return;
467-
}
468-
469455
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
470456
int remaining = span.Length - offset;
471457

src/CommunityToolkit.HighPerformance/Memory/Span2D{T}.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,6 @@ internal Span2D(Span<T> span, int offset, int height, int width, int pitch)
531531
ThrowHelper.ThrowArgumentOutOfRangeExceptionForPitch();
532532
}
533533

534-
if (width == 0 || height == 0)
535-
{
536-
this = default;
537-
538-
return;
539-
}
540-
541534
int area = OverflowHelper.ComputeInt32Area(height, width, pitch);
542535
int remaining = span.Length - offset;
543536

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<Import Project="..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.props" />
4+
<Import Project="..\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.projitems" Label="Shared" />
5+
6+
</Project>

src/CommunityToolkit.Mvvm.SourceGenerators/CommunityToolkit.Mvvm.SourceGenerators.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\FieldWithOrphanedDependentObservablePropertyAttributesAnalyzer.cs" />
5858
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\FieldReferenceForObservablePropertyFieldAnalyzer.cs" />
5959
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\UnsupportedRoslynVersionForPartialPropertyAnalyzer.cs" />
60-
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\RequiresCSharpLanguageVersionPreviewAnalyzer.cs" />
60+
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\RequiresCSharpLanguageVersion14OrPreviewAnalyzer.cs" />
6161
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\InvalidPropertyLevelObservablePropertyAttributeAnalyzer.cs" />
6262
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\UseObservablePropertyOnPartialPropertyAnalyzer.cs" />
6363
<Compile Include="$(MSBuildThisFileDirectory)Diagnostics\Analyzers\UnsupportedCSharpLanguageVersionAnalyzer.cs" />

0 commit comments

Comments
 (0)