Closed riverar closed 4 years ago
@riverar, based on that log, it looks like this wasn't the first time that you attempted a submission update, because it had already found the azure dll dependencies. StoreBroker depends on some Azure dll's in order to do the necessary upload to Azure Blob Storage. It looks for the dll's in your StoreBroker enlistment as well as in a script-cached temp directory. If it can't find them in either location, it automatically downloads them from NuGet and then shows this message:
https://github.com/microsoft/StoreBroker/blob/master/StoreBroker/NugetTools.ps1#L364-L370
I find it curious that the logs indicate that it was able to find those dll dependencies and yet was unable to load the requested assembly.
I'd be curious if you could try the following code in a new PowerShell session:
https://github.com/microsoft/StoreBroker/blob/master/StoreBroker/StoreIngestionApi.psm1#L832-L839, substituting $azureStorageDll
and $azureStorageDataMovementDll
with the dll's from the temp folder that you redacted in the above log.
I haven't heard of any user having this problem before and would like to better understand what's going on.
@HowardWolosky Seems to be a PowerShell Core issue. Digging deeper.
Here's the code I'm using, should print out the overloads for that method. Works in Windows PowerShell 5.x, not Core 6.x. (Haven't tried Core Preview 7.x builds yet.)
$bytes = [System.IO.File]::ReadAllBytes("C:\Users\Rafael\AppData\Local\Temp\d966a35f-66dc-42c6-8694-0236ec847400\WindowsAzure.Storage.8.1.1\lib\net45\Microsoft.WindowsAzure.Storage.dll")
[System.Reflection.Assembly]::Load($bytes) | Out-Null
$bytes = [System.IO.File]::ReadAllBytes("C:\Users\Rafael\AppData\Local\Temp\d966a35f-66dc-42c6-8694-0236ec847400\Microsoft.Azure.Storage.DataMovement.0.5.1\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll")
[System.Reflection.Assembly]::Load($bytes) | Out-Null
[Microsoft.WindowsAzure.Storage.DataMovement.TransferManager]::UploadAsync
Ah, interesting. Please do let me know what you find. We actively run it on PS 4 and PS 5 without issue, but have done no testing or validation against PS Core. Will need to add that to the backlog.
Appears .NET Core 2's implementation of Assembly.Load
is slightly different from .NET Desktop (presumably due to lack of an appdomain impl. in that space).
If my understanding is correct:
.Load
call (https://github.com/sdmaclea/coreclr/blob/1fdb027dd31869d62f6065257d37118c80cc2504/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs#L230)One workaround is to change StoreIngestionApi.psm1
, replacing all instances of [System.Reflection.Assembly]::Load
with [System.Reflection.Assembly]::LoadFrom
. This, at least in CoreCLR, will load assemblies in the default load context.
(https://github.com/sdmaclea/coreclr/blob/1fdb027dd31869d62f6065257d37118c80cc2504/src/System.Private.CoreLib/shared/System/Reflection/Assembly.cs#L337)
In my limited testing, this works in Windows PowerShell and PowerShell Core 6.2.0.
Thanks for the deep-dive, @riverar! Let me do some investigations this week to make sure that doing so works in PS 4 and PS 5. Provided it does, I can make that suggested change (or you can submit the PR yourself to do it, and I'll accept the merge after I've satisfied my validation requirements).
Submitted a PR, no rush. You may need to consider internal use cases and what could be lurking in the default appdomain that could potentially conflict. Maybe a better fix involves creating a custom AppDomain/AssemblyLoadContext for the session.
Have a good rest of the weekend!
Windows 10 1909 18363.418 PSVersion 6.2.0 StoreBroker 1.19.1