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

[V2] Reference assemblies in bin which are created by registering binding extensions #3637

Closed
JohnReeson opened this issue Oct 19, 2018 · 4 comments

Comments

@JohnReeson
Copy link

JohnReeson commented Oct 19, 2018

I find we have to create storage(blob/queue) trigger, i.e. install storage extensions to use syntax like #r "AssemblyName" to reference assembly under D:\home\site\wwwroot\bin.

Repro steps

  1. Create a v2 c# eventhub trigger in portal, install eventhub extensions as required. Confirm installation succeeded as I see assemblies( include Microsoft.Azure.EventHubs.dll) in bin folder.

  2. use code below.

    #r "Microsoft.Azure.EventHubs"
    
    using System;
    using Microsoft.Azure.EventHubs;
    
    public static void Run(EventData myEventHubMessage, ILogger log)
    {
        log.LogInformation($"EnqueuedTimeUtc= {myEventHubMessage.SystemProperties.EnqueuedTimeUtc}");
    }
    
  3. Got compilation error as below

    2018-10-19T15:15:53.595 [Error] run.csx(1,1): error CS0006: Metadata file 'Microsoft.Azure.EventHubs' could not be found
    2018-10-19T15:15:53.732 [Error] run.csx(4,23): error CS0234: The type or namespace name 'EventHubs' does not exist in the namespace 'Microsoft.Azure' (are you missing an assembly reference?)
    2018-10-19T15:15:53.829 [Error] run.csx(6,24): error CS0246: The type or namespace name 'EventData' could not be found (are you missing a using directive or an assembly reference?)
    
  4. Change #r "Microsoft.Azure.EventHubs" to #r "../bin/Microsoft.Azure.EventHubs.dll", then compilation succeeded.

  5. In same function app ,create a queue trigger.(storage extensions installed)

  6. Go back to eventhub trigger and use #r "Microsoft.Azure.EventHubs" again, this time compilation succeeded and code works fine.

  7. To avoid cache or something similar, repeat these steps and repro it in several new Function apps.

  8. Another example is v2 sendgrid template. The template uses queuetrigger(i.e. storage extensions installed) and #r "SendGrid" works. But if the whole function app doesn't install storage extensions, like a time trigger with SendGrid output, we have to use #r "../bin/SendGrid.dll"

Don't understand how this happened, did I miss sth?

@YuichiNukiyama
Copy link

Same thing happens in v2 sendgrid template. The template uses queuetrigger(i.e. storage extensions installed) and #r "SendGrid" works. But in a TimerTrigger with SendGrid output, have to use #r "../bin/SendGrid.dll".

It happened in V2 HttpTrigger Template when I manually add SendGrid to output.

@slyons
Copy link

slyons commented Apr 24, 2019

This is still an issue. Had the same issue with EventHubs:

#r "Microsoft.Azure.EventHubs" did not work, but #r "../bin/Microsoft.Azure.EventHubs.dll" did.

@soninaren
Copy link
Member

This is fixed now. #r "Microsoft.Azure.EventHubs". tested with EventHub version 3.0.6 and function runtime v2 and v3.

@soninaren
Copy link
Member

#r "Microsoft.Azure.EventHubs" should work now. The templates currently use #r "../bin/Microsoft.Azure.EventHubs.dll" which was a tactical fix. Will update the template to use #r "Microsoft.Azure.EventHubs"

@soninaren soninaren modified the milestones: Triaged, Functions Sprint 67 Jan 14, 2020
@Azure Azure locked as resolved and limited conversation to collaborators Feb 13, 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

4 participants