-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed ExpressionNode.EnsureReferenceInfo() crash with .NET Native (#4014
) ## Closes #4011 <!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. --> <!-- Add a brief overview here of the feature/bug & fix. --> ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> - Bugfix <!-- - Feature --> <!-- - Code style update (formatting) --> <!-- - Refactoring (no functional changes, no api changes) --> <!-- - Build or CI related changes --> <!-- - Documentation content changes --> <!-- - Sample app changes --> <!-- - Other... Please describe: --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> Crash with .NET Native, documented in the related issue. ## What is the new behavior? <!-- Describe how was this issue resolved or changed? --> The logic has been changed to not rely on APIs that might have a behavioral change under .NET Native. ## PR Checklist Please check if your PR fulfills the following requirements: - [X] Tested code with current [supported SDKs](../readme.md#supported) - [ ] ~~Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->~~ - [ ] ~~Sample in sample app has been added / updated (for bug fixes / features)~~ - [ ] ~~Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)~~ - [X] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/windows-toolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc... - [X] Tests for the changes have been added (for bug fixes / features) (if applicable) - [X] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [X] Contains **NO** breaking changes
- Loading branch information
Showing
8 changed files
with
42 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Microsoft.Toolkit.Uwp.UI.Animations/Extensions/System/GuidExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Diagnostics.Contracts; | ||
|
||
namespace Microsoft.Toolkit.Uwp.UI.Animations | ||
{ | ||
/// <summary> | ||
/// An extension <see langword="class"/> for the <see cref="Guid"/> type | ||
/// </summary> | ||
internal static class GuidExtensions | ||
{ | ||
/// <summary> | ||
/// Returns a <see cref="string"/> representation of a <see cref="Guid"/> only made of uppercase letters | ||
/// </summary> | ||
/// <param name="guid">The input <see cref="Guid"/> to process</param> | ||
/// <returns>A <see cref="string"/> representation of <paramref name="guid"/> only made up of letters in the [A-Z] range</returns> | ||
[Pure] | ||
public static string ToUppercaseAsciiLetters(in this Guid guid) | ||
{ | ||
// Composition IDs must only be composed of characters in the [A-Z0-9_] set, | ||
// and also have the restriction that the initial character cannot be a digit. | ||
// Because of this, we need to prepend an underscore to a serialized guid to | ||
// avoid cases where the first character is a digit. Additionally, we're forced | ||
// to use ToUpper() here because ToString("N") currently returns a lowercase | ||
// hexadecimal string. Note: this extension might be improved once we move to | ||
// .NET 5 in the WinUI 3 release, by using string.Create<TState>(...) to only | ||
// have a single string allocation, and then using Guid.TryFormat(...) to | ||
// serialize the guid in place over the Span<char> starting from the second | ||
// character. For now, this implementation is fine on UWP and still fast enough. | ||
return $"_{guid.ToString("N").ToUpper()}"; | ||
} | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
Microsoft.Toolkit.Uwp.UI.Media/Extensions/System/GuidExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters