You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FSI: Could not load file or assembly Azure.ResourceManager.Resources #10893
#r "nuget: Azure.Identity, 1.3.0"
#r "nuget: Azure.ResourceManager.Resources, 1.0.0-preview.2"
let creds = Azure.Identity.DefaultAzureCredential()
// next line fails
let resourceClient = Azure.ResourceManager.Resources.ResourcesManagementClient("mySubscriptionId", creds)
Fails with:
error FS0193: Could not load file or assembly 'Azure.ResourceManager.Resources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL'. The system cannot find the file specified.
Note that if Azure.ResourceManager.Resources is replaced with a similar NuGet package Azure.ResourceManager.Insights it works without errors:
#r "nuget: Azure.Identity, 1.3.0"
#r "nuget: Azure.ResourceManager.Insights, 1.0.0-preview.1"
let creds = Azure.Identity.DefaultAzureCredential()
// works fine
let insightsClient = Azure.ResourceManager.Insights.InsightsManagementClient("mySubscriptionId", creds)
@stmax , hmmm this is quite interesting. Because the assembly is not resolvable even though it has already been loaded. I will dig in, see if I can find out what the issue is.
--> Referenced 'C:/Users/codec/.nuget/packages/azure.resourcemanager.resources/1.0.0-preview.2/lib/netstandard2.0/Azure.ResourceManager.Resources.dll' (file may be locked by F# Interactive process)
> let resourceClient = Azure.ResourceManager.Resources.ResourcesManagementClient("mySubscriptionId", creds);;
error FS0193: Could not load file or assembly 'Azure.ResourceManager.Resources, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
>
One more thing I tried is extracting the dll from the nuget package and referencing it directly (#r "Azure.ResourceManager.Resources.dll") - it led to the same error, so this does not seem to be a problem with #r nuget.
Running the same code in a net5.0 console app works fine.
@stmax , yes I tried the same thing last night ... it is an assembly resolution issue, I fear that somehow ... our resolve handlers aren't getting notified.
The issue was actually quite interesting, and shows the evolution in the scenarios for resolution that FSI now has to cope with, thanks to nuget packages.
Anyway, the fix is to make sure that the fsi, assembly resolve handler, will search the list of #r assemblies when trying to resolve assemblies to load.
Activity
KevinRansom commentedon Jan 20, 2021
@stmax , hmmm this is quite interesting. Because the assembly is not resolvable even though it has already been loaded. I will dig in, see if I can find out what the issue is.
stmax82 commentedon Jan 20, 2021
@KevinRansom thanks for looking into it.
One more thing I tried is extracting the dll from the nuget package and referencing it directly (
#r "Azure.ResourceManager.Resources.dll") - it led to the same error, so this does not seem to be a problem with #r nuget.Running the same code in a net5.0 console app works fine.
KevinRansom commentedon Jan 20, 2021
@stmax , yes I tried the same thing last night ... it is an assembly resolution issue, I fear that somehow ... our resolve handlers aren't getting notified.
KevinRansom commentedon Jan 20, 2021
Okay I got it: thanks for this report.
The issue was actually quite interesting, and shows the evolution in the scenarios for resolution that FSI now has to cope with, thanks to nuget packages.
Anyway, the fix is to make sure that the fsi, assembly resolve handler, will search the list of #r assemblies when trying to resolve assemblies to load.
Fix dotnet#10893 - FSI: Could not load file or assembly Azure.Resourc…
Fix #10893 - FSI: Could not load file or assembly Azure.ResourceManag…
stmax82 commentedon Jan 29, 2021
thanks for the fix. didn't expect the name would be the problem :)