2

Any thoughts on what might be causing this exception ?

Exception during runtime resolution of assembly 'Microsoft.Azure.ServiceBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c': 'System.InvalidCastException: [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.0\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.0\System.Runtime.Extensions.dll'.

I have created a class library with .net Standard 2.0 and added 2 azure functions one for httpTrigger & other for serviceBusTrigger.

httpTrigger is working as expected however serviceBusTrigger is crashing with below error Error Message.

ServiceBusTrigger.cs :

using Microsoft.Azure.ServiceBus;

namespace TriggerCore
{
    public static class SBTrigger
    {
        static SBTrigger()
        {
        }
        public static void Run(Message message)
        {
        }
    }
}

function.json :

{
  "bindings": [
    {
      "type": "serviceBusTrigger",
      "queueName": "myqueue",
      "accessRights": "manage",
      "name": "message"
    }
  ],
  "disabled": false,
  "scriptFile": "../TriggerCore.dll",
  "entryPoint": "TriggerCore.SBTrigger.Run"
}

Microsoft.Azure.ServiceBus version 1.0.0

NetStandard.Library version 2.0.0

Janusz Nowak
  • 2,595
  • 1
  • 17
  • 36
santosh
  • 21
  • 3
  • Looks like a version conflict. Give a try to Functions SDK-based project (with attributes and auto-generated `function.json`). – Mikhail Shilkov Oct 10 '17 at 16:48
  • thanks for your help @Mikhail. Instead of Functions SDK-based project which is .net full framework, I would like to go with NetStandard.Library version 2.0.0. Let me know if you have any pointers. – santosh Oct 10 '17 at 19:44
  • Version 1.0.5 of SDK should support .NET Standard, see https://stackoverflow.com/a/46614307/1171619 – Mikhail Shilkov Oct 10 '17 at 20:07

1 Answers1

0

The new .NET Core runtime doesn't yet support ServiceBus trigger. We're still in the process of migrating that and some of the other extensions to .NET Core. See tracking issue here.

mathewc
  • 13,312
  • 2
  • 45
  • 53