Skip to content

Azure Functions 2.0 - EventHubTrigger - System.Private.CoreLib: Could not load file or assembly “FunctionsProject.dll” #4805

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

Closed
manums opened this issue Aug 4, 2019 · 2 comments
Assignees

Comments

@manums
Copy link

manums commented Aug 4, 2019

I was able to run function app which has eventhub binding from local as well as from West US2 Consumption plan. From last 4 days, after we moved all our dependent projects to build in x64 and updating all nugets to latest - function app started failing. It does not even start, it fails to load the functionsproject.dll itself. Same issue even If I deploy bits to Consumption Plan.

  • Functions Project Name here - EventHubConsumers
  • Azure function version - 2.0
  • Azure function tools version - 2.28
  • Project build configuration - x64
  • Net version - NET CORE 2.1
  • Visual Studio 2019 & 2017

Nuget dependencies:

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="3.0.6" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
<PackageReference Include="Microsoft.Jarvis" Version="20190426.1.0-rc" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Polly" Version="7.1.0" /> 

I was not able to pull FusionLog (I gues Functions framework StartLocator have custom logic to load libraries which does not fill fusion log.

I tried debugging LoadFromAssemblyPath(string assemblyPath, bool addProbingPath) in FunctionAssemblyLoadContext.cs which throws this exception. I could see that assembly bin path and verify that my functions app is getting built into that folder itself. I even verified version of the dll and other details by opening up in IlSpy. I cannot make out why assembly (function app dll) could not be loaded when it existed in that path as expected.

  • Logged issues on Github: Link

  • Trying out older versions of Microsoft.Azure.Webjobs.Extensions.Eventhubs i.e. trying out version 3.0.5

  • Clean, delete obj, bin and then running

  • Deleting all older versions of AzureFunctionsTools in LocalAppData except for 2.28.

  • Running from vs2017

[FunctionName("WriteToStore")]
public async Task Run([EventHubTrigger("activities", Connection = "EventHubConnectionAppSetting", ConsumerGroup = "%ConsumerGroup%")] EventData[] events,
             [EventHub("failed-activities", Connection = "EventHubConnectionAppSetting")]IAsyncCollector<EventData> outputEvents)
{
  //Logic here
}

Upgraded Core tools with:
npm i -g azure-functions-core-tools --unsafe-perm true

More details from Functions Console:

Azure Functions Core Tools (2.7.1505 Commit hash: eb81829)

Function Runtime Version: 2.0.12590.0

[8/4/2019 10:09:25 PM] Building host: startup suppressed:False, configuration suppressed: False

[8/4/2019 10:09:26 PM] A host error has occurred

[8/4/2019 10:09:26 PM] System.Private.CoreLib: Could not load file or assembly 'Microsoft..EventHubConsumers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Value cannot be null.

Parameter name: provider

Press any to continue....[8/4/2019 10:09:27 PM] Building host: startup suppressed:False, configuration suppressed: False

[8/4/2019 10:09:27 PM] A host error has occurred

[8/4/2019 10:09:27 PM] System.Private.CoreLib: Could not load file or assembly 'Microsoft..EventHubConsumers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

Hosting environment: Production

Content root path: D:some\EventHubConsumers\bin\x64\Debug\netcoreapp2.1

Now listening on: http://0.0.0.0:7071

Application started. Press Ctrl+C to shut down.

[8/4/2019 10:09:29 PM] Building host: startup suppressed:False, configuration suppressed: False

[8/4/2019 10:09:29 PM] A host error has occurred

[8/4/2019 10:09:29 PM] System.Private.CoreLib: Could not load file or assembly 'Microsoft.some.EventHubConsumers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

@ahmelsayed ahmelsayed transferred this issue from Azure/azure-functions-core-tools Aug 15, 2019
@alrod alrod assigned soninaren and unassigned ahmelsayed Aug 20, 2019
@brettsam
Copy link
Member

We addressed this with @manums via email. Was an x64 issue. The following other issues helped:

@manums
Copy link
Author

manums commented Oct 7, 2019

I could not follow up on this thread earlier. I could get these issues resolved. I have explained things which I followed on stackoverflow page - here.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 31, 2019
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