diff --git a/sdk/core/azure-core/test/ut/context.cpp b/sdk/core/azure-core/test/ut/context.cpp index 5be956610..2807d4fc2 100644 --- a/sdk/core/azure-core/test/ut/context.cpp +++ b/sdk/core/azure-core/test/ut/context.cpp @@ -177,9 +177,17 @@ struct SomeStructForContext int someField = 12345; }; -TEST(Context, UniquePtr) +TEST(Context, InstanceValue) { auto contextP = Context::GetApplicationContext().WithValue("struct", SomeStructForContext()); auto& contextValueRef = contextP.Get("struct"); EXPECT_EQ(contextValueRef.someField, 12345); } + +TEST(Context, UniquePtr) +{ + auto contextP = Context::GetApplicationContext().WithValue( + "struct", std::make_unique()); + auto& contextValueRef = contextP.Get>("struct"); + EXPECT_EQ(contextValueRef->someField, 12345); +} diff --git a/sdk/storage/azure-storage-common/src/storage_switch_to_secondary_policy.cpp b/sdk/storage/azure-storage-common/src/storage_switch_to_secondary_policy.cpp index 9c1fd1413..f8013fb3e 100644 --- a/sdk/storage/azure-storage-common/src/storage_switch_to_secondary_policy.cpp +++ b/sdk/storage/azure-storage-common/src/storage_switch_to_secondary_policy.cpp @@ -13,7 +13,9 @@ namespace Azure { namespace Storage { namespace _detail { SecondaryHostReplicaStatus* replicaStatus = nullptr; if (ctx.HasKey(SecondaryHostReplicaStatusKey)) { - replicaStatus = ctx.Get(SecondaryHostReplicaStatusKey); + replicaStatus + = ctx.Get>(SecondaryHostReplicaStatusKey) + .get(); } bool considerSecondary = (request.GetMethod() == Azure::Core::Http::HttpMethod::Get