diff --git a/change/react-native-windows-11865dea-8398-4e1a-a61a-810a133391ee.json b/change/react-native-windows-11865dea-8398-4e1a-a61a-810a133391ee.json new file mode 100644 index 00000000000..b7e34cd65d8 --- /dev/null +++ b/change/react-native-windows-11865dea-8398-4e1a-a61a-810a133391ee.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Use Boost GUID generator (#11470)", + "packageName": "react-native-windows", + "email": "julio.rocha@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json index dec34f0ba84..b17b6e4f7b6 100644 --- a/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed.UnitTests/packages.lock.json @@ -98,6 +98,11 @@ "Microsoft.NETCore.Platforms": "1.1.0" } }, + "ReactNative.Hermes.Windows": { + "type": "Transitive", + "resolved": "0.0.0-2302.1002-2d4bf1df", + "contentHash": "4skpllUPEBkww7FN7iacP7NWrZlEGDNg83qIuFjKn4Sl8JpJQZqfUTrXcvh6tb4mHXkmwFoKhLw4Rc5Op7f+8w==" + }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", "resolved": "2.2.7-rel-27913-00", @@ -300,14 +305,13 @@ "microsoft.reactnative": { "type": "Project", "dependencies": { - "Common": "1.0.0", - "Folly": "1.0.0", - "Microsoft.UI.Xaml": "2.7.0", - "Microsoft.Windows.CppWinRT": "2.0.211028.7", - "Microsoft.Windows.SDK.BuildTools": "10.0.22000.194", - "ReactCommon": "1.0.0", - "ReactNative.Hermes.Windows": "0.11.0-ms.6", - "boost": "1.76.0" + "Common": "[1.0.0, )", + "Folly": "[1.0.0, )", + "Microsoft.UI.Xaml": "[2.7.0, )", + "Microsoft.Windows.SDK.BuildTools": "[10.0.22000.194, )", + "ReactCommon": "[1.0.0, )", + "ReactNative.Hermes.Windows": "[0.0.0-2302.1002-2d4bf1df, )", + "boost": "[1.76.0, )" } }, "microsoft.reactnative.managed": { diff --git a/vnext/Microsoft.ReactNative.Managed/packages.lock.json b/vnext/Microsoft.ReactNative.Managed/packages.lock.json index decd73cbdce..9935ddff537 100644 --- a/vnext/Microsoft.ReactNative.Managed/packages.lock.json +++ b/vnext/Microsoft.ReactNative.Managed/packages.lock.json @@ -90,8 +90,8 @@ }, "ReactNative.Hermes.Windows": { "type": "Transitive", - "resolved": "0.11.0-ms.6", - "contentHash": "WAVLsSZBV4p/3hNC3W67su7xu3f/ZMSKxu0ON7g2GaKRbkJmH0Qyif1IlzcJwtvR48kuOdfgPu7Bgtz3AY+gqg==" + "resolved": "0.0.0-2302.1002-2d4bf1df", + "contentHash": "4skpllUPEBkww7FN7iacP7NWrZlEGDNg83qIuFjKn4Sl8JpJQZqfUTrXcvh6tb4mHXkmwFoKhLw4Rc5Op7f+8w==" }, "runtime.win10-arm.Microsoft.Net.Native.Compiler": { "type": "Transitive", @@ -176,14 +176,13 @@ "microsoft.reactnative": { "type": "Project", "dependencies": { - "Common": "1.0.0", - "Folly": "1.0.0", - "Microsoft.UI.Xaml": "2.7.0", - "Microsoft.Windows.CppWinRT": "2.0.211028.7", - "Microsoft.Windows.SDK.BuildTools": "10.0.22000.194", - "ReactCommon": "1.0.0", - "ReactNative.Hermes.Windows": "0.11.0-ms.6", - "boost": "1.76.0" + "Common": "[1.0.0, )", + "Folly": "[1.0.0, )", + "Microsoft.UI.Xaml": "[2.7.0, )", + "Microsoft.Windows.SDK.BuildTools": "[10.0.22000.194, )", + "ReactCommon": "[1.0.0, )", + "ReactNative.Hermes.Windows": "[0.0.0-2302.1002-2d4bf1df, )", + "boost": "[1.76.0, )" } }, "reactcommon": { diff --git a/vnext/Shared/Modules/BlobModule.cpp b/vnext/Shared/Modules/BlobModule.cpp index 867e45c0193..10ef4472e8e 100644 --- a/vnext/Shared/Modules/BlobModule.cpp +++ b/vnext/Shared/Modules/BlobModule.cpp @@ -12,6 +12,9 @@ // React Native #include +// Boost Libriaries +#include + // Windows API #include #include @@ -33,7 +36,6 @@ using winrt::Microsoft::ReactNative::IReactPropertyBag; using winrt::Microsoft::ReactNative::ReactNonAbiValue; using winrt::Microsoft::ReactNative::ReactPropertyBag; using winrt::Microsoft::ReactNative::ReactPropertyId; -using winrt::Windows::Foundation::GuidHelper; using winrt::Windows::Foundation::IInspectable; using winrt::Windows::Foundation::Uri; using winrt::Windows::Security::Cryptography::CryptographicBuffer; @@ -249,8 +251,7 @@ void MemoryBlobPersistor::StoreMessage(vector &&message, string &&blobI } string MemoryBlobPersistor::StoreMessage(vector &&message) noexcept { - // substr(1, 36) strips curly braces from a GUID. - auto blobId = winrt::to_string(winrt::to_hstring(GuidHelper::CreateNewGuid())).substr(1, 36); + auto blobId = boost::uuids::to_string(m_guidGenerator()); scoped_lock lock{m_mutex}; m_blobs.insert_or_assign(blobId, std::move(message)); diff --git a/vnext/Shared/Modules/BlobModule.h b/vnext/Shared/Modules/BlobModule.h index 76c5d46e5e7..900bf5c5d18 100644 --- a/vnext/Shared/Modules/BlobModule.h +++ b/vnext/Shared/Modules/BlobModule.h @@ -11,6 +11,9 @@ // React Native #include +// Boost Libraries +#include + // Windows API #include @@ -26,6 +29,7 @@ namespace Microsoft::React { class MemoryBlobPersistor final : public IBlobPersistor { std::unordered_map> m_blobs; std::mutex m_mutex; + boost::uuids::random_generator m_guidGenerator; public: #pragma region IBlobPersistor