none
Missing assemblies since two days RRS feed

  • Question

  • Hi there,

    yesterday I realised during a demo, that some assemblies, which where available before are missing. On sunday, while I was presenting the same demo, all worked fine, but now I seems that some parts are just gone, which doesn't make sense, since those are part of the WebJobsSdk, so I was wondering what happend.

    This is the error-message:

    2017-03-22T09:21:40.492 (2,1): error CS0006: Metadata file 'Microsoft.Azure.WebJobs.Extensions.NotificationHubs' could not be found
    2017-03-22T09:21:40.492 (7,42): error CS0234: The type or namespace name 'NotificationHubs' does not exist in the namespace 'Microsoft.Azure.WebJobs.Extensions' (are you missing an assembly reference?)
    2017-03-22T09:21:40.492 (15,38): error CS0246: The type or namespace name 'NotificationHubAttribute' could not be found (are you missing a using directive or an assembly reference?)
    

    This is how the code looks like:

    #r "Newtonsoft.Json"
    #r "Microsoft.Azure.WebJobs.Extensions.NotificationHubs"
    #r "Microsoft.Azure.NotificationHubs"
    using System;
    using Newtonsoft.Json.Linq;
    using Newtonsoft.Json;
    using Microsoft.Azure.WebJobs.Extensions.NotificationHubs;
    using Microsoft.Azure.WebJobs;
    using Microsoft.Azure.NotificationHubs;
    
    public static async Task Run(NotifyItem myQueueItem, Binder binder, TraceWriter log)
    {
    
        log.Info(JsonConvert.SerializeObject(myQueueItem));
        var notificationHubBinding = new NotificationHubAttribute() 
        { 
            TagExpression = $"id:{myQueueItem.notifyurl} && {myQueueItem.messageid}",
            ConnectionStringSetting = "carnotify_NOTIFICATIONHUB",
            HubName = "carnotify",
            EnableTestSend = false
        };
        log.Info(JsonConvert.SerializeObject(notificationHubBinding));
        var client = await binder.BindAsync<IAsyncCollector<IDictionary<string,string>>>(notificationHubBinding);
        await client.AddAsync(GetTemplateProperties(myQueueItem.plate));
    }
    
    private static IDictionary<string, string> GetTemplateProperties(string plate)
    {
        Dictionary<string, string> templateProperties = new Dictionary<string, string>();
        templateProperties["plate"] = plate;
        return templateProperties;
    }
    
    public class NotifyItem 
    {
        public string plate { get; set; }
        public string notifyurl { get; set; }
        public string messageid { get; set; }
    
    }

    When you are wondering, while I'm binding myself within the code, this is since for some reason binding the TagExpression to the input item does not work. I'm sure, this was working before, but in the latest versions this also stopped working. Which is a bad experience, since the binding is one of the major advantages of Azure Functions over other serverless frameworks.

    I'm going to work around this issue by using nuget-packages, but I think there went something wrong.

    Regards,

    Sia

    Wednesday, March 22, 2017 9:36 AM

Answers

  • I took a look at your function code in your site, and it looks like your current version no longer has the required #r statements at the top of the file, which is why your code isn't compiling. You need:

    #r "Newtonsoft.Json"
    #r "Microsoft.Azure.WebJobs.Extensions.NotificationHubs"
    #r "Microsoft.Azure.NotificationHubs"


    The NotificationHubAttribute that you're referencing in your code is defined in the Microsoft.Azure.WebJobs.Extensions.NotificationHubs assembly. Add those references (#r) and you should be good. Also remove the project.json workarounds you added before - those are no longer needed, and may be causing you issues.


    Mathew Charles [MSFT]


    Tuesday, March 28, 2017 12:15 AM

All replies

  • Hi Sia,

    We identified that issue, and we have issued a patch. Can you please verify that everything works now?

    Sorry for the inconvenience.

    thanks,
    David

    Thursday, March 23, 2017 9:58 PM
  • Hi David,

    I just tried it out. Still having the same issue, that it's not finding the assemblies.

    Well using a project.json and setting all libs works, but this is still just a workaraound:

    {
      "frameworks": {
        "net46":{
          "dependencies": {
            "Microsoft.Azure.WebJobs.Extensions": "2.0.0",
            "Microsoft.Azure.WebJobs.Extensions.NotificationHubs": "1.0.0",
            "Microsoft.Azure.NotificationHubs": "1.0.7"
          }
        }
       }
    }
    

    Thanks and let me know if I can help with further testing,

    Sia

    Monday, March 27, 2017 9:17 AM
  • Can you try restarting your Function App? That will guarantee that it gets the new bits.

    If you still get the error after restart, can you share your function app name (that's the function app name, not the function name), either directly or indirectly? This will help us investigate. Thanks!

    David

    Monday, March 27, 2017 3:01 PM
  • Hi David,

    I always thought changing project.json restarts the app. Anyhow, I restarted the App and it still didn't work.

    Here are the app's name and the function's name:

    App Name: carnotify.azurewebsites.net

    Function Name: SendNotificationCs

    I reverted the changes, so it'll still be the workaround.

    Please let know, if I can assist you further,

    Sia


    • Edited by Sia GMVP Monday, March 27, 2017 7:49 PM
    Monday, March 27, 2017 7:48 PM
  • I took a look at your function code in your site, and it looks like your current version no longer has the required #r statements at the top of the file, which is why your code isn't compiling. You need:

    #r "Newtonsoft.Json"
    #r "Microsoft.Azure.WebJobs.Extensions.NotificationHubs"
    #r "Microsoft.Azure.NotificationHubs"


    The NotificationHubAttribute that you're referencing in your code is defined in the Microsoft.Azure.WebJobs.Extensions.NotificationHubs assembly. Add those references (#r) and you should be good. Also remove the project.json workarounds you added before - those are no longer needed, and may be causing you issues.


    Mathew Charles [MSFT]


    Tuesday, March 28, 2017 12:15 AM
  • Hi Matt,

    thanks for you reply. Yeah, this makes sense. I didn't think about that when I tried it yesterday...

    I'll change the implementation and delete the Workaround. Is there any information regarding the Bindings, so that don't need the Binder anylonger and can just bind to the Queue-Items props from the TagExpression?

    Thanks,

    Sia


    • Edited by Sia GMVP Tuesday, March 28, 2017 6:51 AM
    Tuesday, March 28, 2017 6:49 AM
  • Here is sample for binding to tagExpression. Hope this helps.


    Tuesday, March 28, 2017 6:13 PM