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
Could Not load Microsoft.CodeAnalysis.Scripting in Azure Function #7
Comments
I suspect that there is some compatibility issues with the latest version of Roslyn (scripting). Can you send me a hello-world style sample so I can investigate it. If for whatever reasons it's not an option then try to download the package manually and reference it as assemblies and not as nuget package. |
Please run this within an Azure Function/Emulator to reproduce.
|
I cannot run/debug it on Azure. I just don't have an Azure environment handy. But I tested it locally and your code runs just fine. using Microsoft.CodeAnalysis.Scripting;
// and
CSScript.Evaluator.ReferenceAssembliesFromCode(SayHello); It's clear that you have problem with As a test code you can try to load |
Thanks @oleg-shilo for running in through, this code block runs fine in my core console app also, the exception arises only when I run it within an Azure Function environment. I tried instantiating a type from |
The fact that it is running fine with v1.0.1 does not help much. None from the added functionality of v1.2.2 should trigger any probing problems. at least i cannot see any obvius suspect. I suspect that there is a missmatch between requested and available version of using System;
using Microsoft.CodeAnalysis;
using CSScriptLib;
namespace ConsoleApp18
{
class Program
{
static void Main(string[] args)
{
var avaliableAsm = typeof(MetadataReference).Assembly;
Console.WriteLine("Available: " + avaliableAsm);
AppDomain.CurrentDomain.AssemblyResolve += (s, a) =>
{
Console.WriteLine("Trying to resolve: " + a.Name);
// return avaliableAsm;
return null;
};
LoadEngine();
}
static void LoadEngine()
{
var SayHello = @"using System;
using System.IO;
public class Helper
{
public void SayHello()
{
Console.WriteLine(""Hello World!"");
}
}";
dynamic block = CSScript.Evaluator.LoadCode(SayHello);
block.SayHello();
}
}
} Run this code on Asure. I suspect that the first console output ('Available: ...') will not ble like mine: Most likely it will be some other version. And "Trying to resolve: " will be trying to find the required v2.10. If it is the case you can try to uncomment Let me know how did it go. |
see Azure/azure-functions-host/issues/5796 @oleg-shilo this could be closed |
Thank you for letting me know |
Version 1.2.2 had a problem in loading the Microsoft.CodeAnalysis.Scripting reference, while downgrading to version 1.0.1 works well in an Azure Function. The above error occurs while using the CSScript class.
The text was updated successfully, but these errors were encountered: