Skip to content

Commit 47a0818

Browse files
Merge branch 'main' into TextBoxMask_bug_3279
2 parents f10a3bd + 1abf8f8 commit 47a0818

File tree

126 files changed

+2478
-898
lines changed

Some content is hidden

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

126 files changed

+2478
-898
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->
22

3-
<!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->
3+
<!-- 👉 It is imperative to resolve ONE ISSUE PER PR and avoid making multiple changes unless the changes interrelate with each other -->
4+
5+
<!-- 📝 Please always keep the "☑️ Allow edits by maintainers" button checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->
46

57

68
## Fixes #
7-
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->
9+
<!-- Add the relevant issue number after the "#" mentioned above (for ex: "## Fixes #1234") which will automatically close the issue once the PR is merged. -->
810

911
<!-- Add a brief overview here of the feature/bug & fix. -->
1012

1113
## PR Type
1214
What kind of change does this PR introduce?
13-
<!-- Please uncomment one or more that apply to this PR. -->
15+
<!-- Please uncomment one or more options below that apply to this PR. -->
1416

1517
<!-- - Bugfix -->
1618
<!-- - Feature -->
File renamed without changes.

Directory.Build.props

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3232
</PropertyGroup>
3333
</When>
34+
<Otherwise>
35+
<PropertyGroup>
36+
<IsPackable>false</IsPackable>
37+
</PropertyGroup>
38+
</Otherwise>
3439
</Choose>
3540

3641
<Choose>
@@ -45,33 +50,33 @@
4550
<When Condition="'$(Configuration)' == 'Debug' and '$(IsDesignProject)' != 'true'">
4651
<!-- Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios -->
4752
<PropertyGroup>
48-
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
4953
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
54+
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
5055
</PropertyGroup>
5156
</When>
5257
</Choose>
5358

5459
<Choose>
5560
<When Condition="'$(SourceLinkEnabled)' != 'false' and '$(IsSampleProject)' != 'true'">
5661
<PropertyGroup>
57-
<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
62+
<!-- Declare that the Repository URL can be published to NuSpec -->
5863
<PublishRepositoryUrl>true</PublishRepositoryUrl>
59-
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
64+
<!-- Embed source files that are not tracked by the source control manager to the PDB -->
6065
<EmbedUntrackedSources>true</EmbedUntrackedSources>
61-
<!-- Optional: Include PDB in the built .nupkg -->
66+
<!-- Include PDB in the built .nupkg -->
6267
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
6368
</PropertyGroup>
6469
<ItemGroup>
65-
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All"/>
66-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
70+
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All" />
71+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
6772
</ItemGroup>
6873
</When>
6974
</Choose>
7075

7176
<Choose>
7277
<When Condition="'$(IsDesignProject)' != 'true'">
7378
<ItemGroup>
74-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive"/>
79+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
7580
</ItemGroup>
7681
</When>
7782
</Choose>
@@ -103,10 +108,10 @@
103108
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
104109
<Link>stylecop.json</Link>
105110
</AdditionalFiles>
106-
<None Include="$(MSBuildThisFileDirectory)license.md" Pack="true" PackagePath="\"/>
107-
<None Include="$(MSBuildThisFileDirectory)build\nuget.png" Pack="true" PackagePath="images\"/>
111+
<None Include="$(MSBuildThisFileDirectory)License.md" Pack="true" PackagePath="\" />
112+
<None Include="$(MSBuildThisFileDirectory)build\nuget.png" Pack="true" PackagePath="images\" />
108113
</ItemGroup>
109114

110-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'"/>
115+
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'" />
111116

112117
</Project>

Directory.Build.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<Choose>
8-
<!--We'll include signing the Notifications library since we need the DLL signature to match for interop from class libraries to main projects-->
8+
<!-- We'll include signing the Notifications library since we need the DLL signature to match for interop from class libraries to main projects -->
99
<When Condition="(!$(TargetFramework.Contains(`uap10.0`)) and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true') or $(MSBuildProjectName) == 'Microsoft.Toolkit.Uwp.Notifications'">
1010
<PropertyGroup>
1111
<SignAssembly>true</SignAssembly>
@@ -15,11 +15,11 @@
1515
</Choose>
1616

1717
<!--Exclude Notifications project from this since it sets different min versions than what we want for notifications-->
18-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true' and $(MSBuildProjectName) != 'Microsoft.Toolkit.Uwp.Notifications'"/>
18+
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true' and $(MSBuildProjectName) != 'Microsoft.Toolkit.Uwp.Notifications'" />
1919

2020
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
2121
<ItemGroup>
22-
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition=" '$(SourceRevisionId)' != '' ">
22+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute" Condition="'$(SourceRevisionId)' != ''">
2323
<_Parameter1>CommitHash</_Parameter1>
2424
<_Parameter2>$(SourceRevisionId)</_Parameter2>
2525
</AssemblyAttribute>

GazeInputTest/GazeInputTest.csproj

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@
151151
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
152152
<Version>6.2.12</Version>
153153
</PackageReference>
154-
<PackageReference Include="StyleCop.Analyzers">
155-
<Version>1.0.2</Version>
156-
</PackageReference>
157154
</ItemGroup>
158155
<ItemGroup>
159156
<ProjectReference Include="..\Microsoft.Toolkit.Uwp.Input.GazeInteraction\Microsoft.Toolkit.Uwp.Input.GazeInteraction.csproj">
@@ -165,11 +162,6 @@
165162
<VisualStudioVersion>14.0</VisualStudioVersion>
166163
</PropertyGroup>
167164
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
168-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
169-
Other similar extension points exist, see Microsoft.Common.targets.
170-
<Target Name="BeforeBuild">
171-
</Target>
172-
<Target Name="AfterBuild">
173-
</Target>
174-
-->
165+
<!-- No-op to avoid build error when packing solution from commandline -->
166+
<Target Name="Pack" />
175167
</Project>

GazeInputTest/Properties/Default.rd.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,13 @@
1414
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
1515
<Namespace Name="DataClasses.ViewModels" Serialize="All" />
1616
-->
17-
1817
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
1918
<Application>
2019
<!--
2120
An Assembly element with Name="*Application*" applies to all assemblies in
2221
the application package. The asterisks are not wildcards.
2322
-->
2423
<Assembly Name="*Application*" Dynamic="Required All" />
25-
26-
2724
<!-- Add your application specific runtime directives here. -->
28-
29-
3025
</Application>
3126
</Directives>

license.md renamed to License.md

File renamed without changes.

Microsoft.Toolkit.Diagnostics/Microsoft.Toolkit.Diagnostics.csproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,35 @@
1313
</Description>
1414
<PackageTags>Windows;Community;Toolkit;WCT;UWP;Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;extensions;helpers</PackageTags>
1515
</PropertyGroup>
16+
1617
<Choose>
17-
<When Condition=" '$(TargetFramework)' == 'netstandard1.4' ">
18+
<When Condition="'$(TargetFramework)' == 'netstandard1.4'">
19+
<!-- .NET Standard 1.4 doesn't have the Span<T> type, ValueTuple or the [Pure] attribute -->
1820
<ItemGroup>
19-
20-
<!-- .NET Standard 1.4 doesn't have the Span<T> type, ValueTuple or the [Pure] attribute -->
2121
<PackageReference Include="System.Diagnostics.Contracts" Version="4.3.0" />
2222
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
2323
<PackageReference Include="System.Memory" Version="4.5.4" />
2424
</ItemGroup>
2525
</When>
26-
<When Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
27-
<ItemGroup>
2826

29-
<!-- .NET Standard 2.0 doesn't have the Span<T> type -->
27+
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
28+
<!-- .NET Standard 2.0 doesn't have the Span<T> type -->
29+
<ItemGroup>
3030
<PackageReference Include="System.Memory" Version="4.5.4" />
3131
</ItemGroup>
3232
</When>
33-
<When Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
33+
34+
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
3435
<PropertyGroup>
3536
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
3637
</PropertyGroup>
38+
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
3739
<ItemGroup>
38-
39-
<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
4040
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" />
4141
</ItemGroup>
4242
</When>
43-
<When Condition=" '$(TargetFramework)' == 'net5.0' ">
43+
44+
<When Condition="'$(TargetFramework)' == 'net5.0'">
4445
<PropertyGroup>
4546
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
4647
</PropertyGroup>

Microsoft.Toolkit.HighPerformance/Enumerables/ReadOnlyRefEnumerable{T}.cs

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#endif
1111
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
1212
using Microsoft.Toolkit.HighPerformance.Memory.Internals;
13-
1413
#if !SPAN_RUNTIME_SUPPORT
1514
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
1615
#endif
@@ -121,6 +120,65 @@ internal ReadOnlyRefEnumerable(object? instance, IntPtr offset, int length, int
121120
}
122121
#endif
123122

123+
/// <summary>
124+
/// Gets the total available length for the sequence.
125+
/// </summary>
126+
public int Length
127+
{
128+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
129+
#if SPAN_RUNTIME_SUPPORT
130+
get => this.span.Length;
131+
#else
132+
get => this.length;
133+
#endif
134+
}
135+
136+
/// <summary>
137+
/// Gets the element at the specified zero-based index.
138+
/// </summary>
139+
/// <param name="index">The zero-based index of the element.</param>
140+
/// <returns>A reference to the element at the specified index.</returns>
141+
/// <exception cref="IndexOutOfRangeException">
142+
/// Thrown when <paramref name="index"/> is invalid.
143+
/// </exception>
144+
public ref readonly T this[int index]
145+
{
146+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
147+
get
148+
{
149+
if ((uint)index >= (uint)Length)
150+
{
151+
ThrowHelper.ThrowIndexOutOfRangeException();
152+
}
153+
154+
#if SPAN_RUNTIME_SUPPORT
155+
ref T r0 = ref MemoryMarshal.GetReference(this.span);
156+
#else
157+
ref T r0 = ref RuntimeHelpers.GetObjectDataAtOffsetOrPointerReference<T>(this.instance, this.offset);
158+
#endif
159+
nint offset = (nint)(uint)index * (nint)(uint)this.step;
160+
ref T ri = ref Unsafe.Add(ref r0, offset);
161+
162+
return ref ri;
163+
}
164+
}
165+
166+
#if NETSTANDARD2_1_OR_GREATER
167+
/// <summary>
168+
/// Gets the element at the specified zero-based index.
169+
/// </summary>
170+
/// <param name="index">The zero-based index of the element.</param>
171+
/// <returns>A reference to the element at the specified index.</returns>
172+
/// <exception cref="IndexOutOfRangeException">
173+
/// Thrown when <paramref name="index"/> is invalid.
174+
/// </exception>
175+
public ref readonly T this[Index index]
176+
{
177+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
178+
get => ref this[index.GetOffset(Length)];
179+
}
180+
#endif
181+
124182
/// <inheritdoc cref="System.Collections.IEnumerable.GetEnumerator"/>
125183
[Pure]
126184
[MethodImpl(MethodImplOptions.AggressiveInlining)]

Microsoft.Toolkit.HighPerformance/Enumerables/RefEnumerable{T}.cs

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
using System.Runtime.InteropServices;
1010
#endif
1111
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
12-
#if SPAN_RUNTIME_SUPPORT
1312
using Microsoft.Toolkit.HighPerformance.Memory.Internals;
14-
#else
13+
#if !SPAN_RUNTIME_SUPPORT
1514
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;
1615
#endif
1716

@@ -39,11 +38,6 @@ public readonly ref struct RefEnumerable<T>
3938
/// The initial offset within <see cref="Instance"/>.
4039
/// </summary>
4140
internal readonly IntPtr Offset;
42-
43-
/// <summary>
44-
/// The total available length for the sequence.
45-
/// </summary>
46-
internal readonly int Length;
4741
#endif
4842

4943
/// <summary>
@@ -109,6 +103,65 @@ internal RefEnumerable(object? instance, IntPtr offset, int length, int step)
109103
}
110104
#endif
111105

106+
/// <summary>
107+
/// Gets the total available length for the sequence.
108+
/// </summary>
109+
public int Length
110+
{
111+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
112+
#if SPAN_RUNTIME_SUPPORT
113+
get => this.Span.Length;
114+
#else
115+
get;
116+
#endif
117+
}
118+
119+
/// <summary>
120+
/// Gets the element at the specified zero-based index.
121+
/// </summary>
122+
/// <param name="index">The zero-based index of the element.</param>
123+
/// <returns>A reference to the element at the specified index.</returns>
124+
/// <exception cref="IndexOutOfRangeException">
125+
/// Thrown when <paramref name="index"/> is invalid.
126+
/// </exception>
127+
public ref T this[int index]
128+
{
129+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
130+
get
131+
{
132+
if ((uint)index >= (uint)Length)
133+
{
134+
ThrowHelper.ThrowIndexOutOfRangeException();
135+
}
136+
137+
#if SPAN_RUNTIME_SUPPORT
138+
ref T r0 = ref MemoryMarshal.GetReference(this.Span);
139+
#else
140+
ref T r0 = ref RuntimeHelpers.GetObjectDataAtOffsetOrPointerReference<T>(this.Instance, this.Offset);
141+
#endif
142+
nint offset = (nint)(uint)index * (nint)(uint)this.Step;
143+
ref T ri = ref Unsafe.Add(ref r0, offset);
144+
145+
return ref ri;
146+
}
147+
}
148+
149+
#if NETSTANDARD2_1_OR_GREATER
150+
/// <summary>
151+
/// Gets the element at the specified zero-based index.
152+
/// </summary>
153+
/// <param name="index">The zero-based index of the element.</param>
154+
/// <returns>A reference to the element at the specified index.</returns>
155+
/// <exception cref="IndexOutOfRangeException">
156+
/// Thrown when <paramref name="index"/> is invalid.
157+
/// </exception>
158+
public ref T this[Index index]
159+
{
160+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
161+
get => ref this[index.GetOffset(Length)];
162+
}
163+
#endif
164+
112165
/// <inheritdoc cref="System.Collections.IEnumerable.GetEnumerator"/>
113166
[Pure]
114167
[MethodImpl(MethodImplOptions.AggressiveInlining)]

0 commit comments

Comments
 (0)