title: How do I use an Azure Notification Hub in an asynchronous Azure Function?
body: <p>I'm attempting to create a Precompiled Azure Function that makes use of an Azure Notification Hub, and I'm having some difficulty getting it to run.</p>
  
  <p>My issue is outlined below.</p>
  
  <p>My steps:
  1. Start local development of an Azure Function in Visual Studio.
  2. Create an async Function that uses the NotificationHub attribute. For example, here's a simplified version of mine:</p>
  
  <pre><code>[FunctionName("MyFunction")]
      public static async Task Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, 
                                   [NotificationHub]IAsyncCollector&lt;Notification&gt; notification,
                                   TraceWriter log)
      {                                    
          using (var httpClient = new HttpClient())
          {
              try
              {
                  // Make several async calls, and create a Windows TileNotification here...
                      await notification.AddAsync(new WindowsNotification(tileContent.GetContent()));
                  }                    
              }                
              catch (Exception ex)
              {
                  // log failure, etc.
              }
          }
      }
  </code></pre>
  
  <p>I get the following error message when I attempt to run locally:</p>
  
  <p>Microsoft.Azure.WebJobs.Host: Error indexing method 'MyFunction.Run'. </p>
  
  <p>Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'notification' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, 
  Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).</p>
  
  <p>The documentation has several synchronous examples using <code>out</code> parameters, but no asynchronous examples, and I'm not quite certain what the error message is trying to tell me. Does my NotificationHub attribute need additional configuration? Do I need a functions.json file even though I'm attemtping to use the Precompile Attribute?</p>