Skip to content

update assembly version of Azure.Core #12082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Updated Azure.Core assembly
* Fixed an issue that may cause `Connect-AzAccount` to fail in multi-threaded execution [#11201]

## Version 1.8.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
try {
[Microsoft.Azure.PowerShell.Authenticators.DesktopAuthenticatorBuilder]::Apply([Microsoft.Azure.Commands.Common.Authentication.AzureSession]::Instance)
} catch {}

try {
[Microsoft.Azure.Commands.Profile.Utilities.CustomAssemblyResolver]::Initialize()
} catch {}
}
37 changes: 37 additions & 0 deletions src/Accounts/Accounts/Utilities/CustomAssemblyResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.IO;
using System.Reflection;

namespace Microsoft.Azure.Commands.Profile.Utilities
{
public static class CustomAssemblyResolver
{
public static void Initialize()
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}

/// <summary>
/// When the resolution of an assembly fails, if it's Newtonsoft.Json 9, redirect to 10
/// </summary>
public static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
try
{
AssemblyName name = new AssemblyName(args.Name);
if(string.Equals(name.Name, "Azure.Core", StringComparison.OrdinalIgnoreCase)
&& name.Version?.Major == 1 && (name.Version?.Minor == 2 && name.Version?.Build <= 1 ||
name.Version?.Minor == 1))
{
string accountFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string azureCorePath = Path.Combine(accountFolder, @"PreloadAssemblies\Azure.Core.dll");
return Assembly.LoadFrom(azureCorePath);
}
}
catch
{
}
return null;
}
}
}
1 change: 1 addition & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Moved the logic of loading Azure.Core to Az.Accounts

## Version 2.1.0
* Updated assembly version of data plane cmdlets
Expand Down
5 changes: 0 additions & 5 deletions src/Storage/Storage/Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
<RootNamespace>Microsoft.WindowsAzure.Commands.$(PsModuleName)</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PreLoadAssemblies Include="$(RepoSrc)lib\Azure.Core\PreloadAssemblies\*.dll" />
<NetCoreAssemblies Include="$(RepoSrc)lib\Azure.Core\NetCoreAssemblies\*.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.4.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.0.0" />
Expand Down
Binary file modified src/lib/Azure.Core/NetCoreAssemblies/Azure.Core.dll
Binary file not shown.
Binary file modified src/lib/Azure.Core/PreloadAssemblies/Azure.Core.dll
Binary file not shown.