Skip to content
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

[A]System.AppDomain cannot be cast to [B]System.AppDomain #2854

Closed
kornakar opened this issue May 16, 2018 · 1 comment
Closed

[A]System.AppDomain cannot be cast to [B]System.AppDomain #2854

kornakar opened this issue May 16, 2018 · 1 comment

Comments

@kornakar
Copy link

kornakar commented May 16, 2018

When trying to run a ServiceBusTrigger function in development environment, I get following exceptions in the Diagnostics Tool's Event window. This happens even with a fresh solution and project. This may be related to #2786.

Investigative information

Local development environment
Windows 10
Visual Studio 2017 Enterprise 15.6.4
Azure Functions and Web Jobs 15.0.40502.0

Function App version: 3.0.0-beta5
Sdk.Functions version: 1.0.13
netstandard2

Repro steps

  • Create a new solution with Azure Function (Azure Functions v2 Preview (.NET Standard))
  • Use development storage (UseDevelopmentStorage=true)
  • Use any valid connection string (note that QueueTrigger and ServiceBusTriggers use different connection strings)
  • Add nuget package: Install-Package Microsoft.Azure.WebJobs.ServiceBus -Version 3.0.0-beta5
  • Change QueueTriggerAttribute to ServiceBusTriggerAttribute in the Function1.Run method
  • Run the project

Actual behavior

Console output:

[16/05/2018 11.39.29] Host configuration file read:
[16/05/2018 11.39.29] {}
[16/05/2018 11.39.29] Starting Host (HostId=echelwjvai2-236828010, InstanceId=758df03a-d168-4782-877d-a8562079faa5, Version=2.0.11651.0, ProcessId=16856, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)
[16/05/2018 11.39.29] Unable to configure java worker. Could not find JAVA_HOME app setting.
[16/05/2018 11.39.29]
[16/05/2018 11.39.29] Could not configure language worker Java.
[16/05/2018 11.39.29]
[16/05/2018 11.39.30] Loaded custom extension: ServiceBusExtensionConfig from 'referenced by: Method='FunctionApp1.Function1.Run', Parameter='myQueueItem'.'
[16/05/2018 11.39.30] Generating 1 job function(s)
[16/05/2018 11.39.30] Found the following functions:
[16/05/2018 11.39.30] FunctionApp1.Function1.Run
[16/05/2018 11.39.30]
[16/05/2018 11.39.30] Host initialized (1290ms)
Listening on http://localhost:7071/
Hit CTRL-C to exit...
[16/05/2018 11.39.31] Host started (1920ms)
[16/05/2018 11.39.31] Job host started
[16/05/2018 11.39.31] Host lock lease acquired by instance ID '00000000000000000000000010A97A99'.

Exception in the Diagnostics Tool event window:

Exception: Exception thrown: 'System.InvalidCastException' in Microsoft.Azure.WebJobs.Script.dll ("[A]System.AppDomain cannot be cast to [B]System.AppDomain. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Type B originates from 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Runtime.Extensions.dll'."). Exception thrown: 'System.InvalidCastException' in Microsoft.Azure.WebJobs.Script.dll ("[A]System.AppDomain cannot be cast to [B]System.AppDomain. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Private.CoreLib.dll'. Type B originates from 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.6\System.Runtime.Extensions.dll'.") 2.87s [17352] Worker Thread

Related information

Source
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([ServiceBusTrigger("myqueuename", Connection = "QueueConnectionString")]string myQueueItem, TraceWriter log)
        {
            log.Info($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
@paulbatum
Copy link
Member

This has been resolved, and there is currently a deployment in progress with the fix. You should see this error disappear by the end of the week.

@ghost ghost locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants