From daba64697eea30211ba7228484691111ed24867f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 16 Oct 2024 15:49:33 -0700 Subject: [PATCH] Implement fix in DNMD for https://github.com/dotnet/runtime/pull/108907 (#56) Co-authored-by: Aaron Robinson --- src/interfaces/importhelpers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interfaces/importhelpers.cpp b/src/interfaces/importhelpers.cpp index 3dbb33e6..0c713df6 100644 --- a/src/interfaces/importhelpers.cpp +++ b/src/interfaces/importhelpers.cpp @@ -602,13 +602,15 @@ namespace uint32_t publicKeyLength; if (1 != md_get_column_value_as_blob(sourceAssembly, mdtAssembly_PublicKey, 1, &publicKey, &publicKeyLength)) return E_FAIL; - + + span publicKeyTokenSpan; StrongNameToken publicKeyToken; if (publicKey != nullptr) { assert(IsAfPublicKey(flags)); flags &= ~afPublicKey; RETURN_IF_FAILED(StrongNameTokenFromPublicKey({ publicKey, publicKeyLength }, publicKeyToken)); + publicKeyTokenSpan = { publicKeyToken.data(), publicKeyToken.size() }; } else { @@ -648,7 +650,7 @@ namespace flags, assemblyName, assemblyCulture, - { publicKeyToken.data(), publicKeyToken.size() }, + publicKeyTokenSpan, targetAssembly)); if (hr == S_OK)