From e571eb30504df2a6bbbbcb42f830ee179c8288e7 Mon Sep 17 00:00:00 2001 From: Konstantin S Date: Thu, 9 Mar 2023 06:17:20 +1000 Subject: [PATCH] Add missing Dispose() call to HashCode --- .../Helpers/HashCode.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CommunityToolkit.Mvvm.SourceGenerators/Helpers/HashCode.cs b/src/CommunityToolkit.Mvvm.SourceGenerators/Helpers/HashCode.cs index bd615271c..0548c4467 100644 --- a/src/CommunityToolkit.Mvvm.SourceGenerators/Helpers/HashCode.cs +++ b/src/CommunityToolkit.Mvvm.SourceGenerators/Helpers/HashCode.cs @@ -35,7 +35,10 @@ private static unsafe uint GenerateGlobalSeed() { byte[] bytes = new byte[4]; - RandomNumberGenerator.Create().GetBytes(bytes); + using (RandomNumberGenerator generator = RandomNumberGenerator.Create()) + { + generator.GetBytes(bytes); + } return BitConverter.ToUInt32(bytes, 0); } @@ -182,4 +185,4 @@ private static uint RotateLeft(uint value, int offset) { return (value << offset) | (value >> (32 - offset)); } -} \ No newline at end of file +}