{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/Azure-Functions/issues/916","repository_url":"https://api.github.com/repos/Azure/Azure-Functions","labels_url":"https://api.github.com/repos/Azure/Azure-Functions/issues/916/labels{/name}","comments_url":"https://api.github.com/repos/Azure/Azure-Functions/issues/916/comments","events_url":"https://api.github.com/repos/Azure/Azure-Functions/issues/916/events","html_url":"https://github.com/Azure/Azure-Functions/issues/916","id":352268363,"node_id":"MDU6SXNzdWUzNTIyNjgzNjM=","number":916,"title":"Azure Functions v2 Assembly Binding Issue","user":{"login":"jnevins-gcm","id":12611761,"node_id":"MDQ6VXNlcjEyNjExNzYx","avatar_url":"https://avatars3.githubusercontent.com/u/12611761?v=4","gravatar_id":"","url":"https://api.github.com/users/jnevins-gcm","html_url":"https://github.com/jnevins-gcm","followers_url":"https://api.github.com/users/jnevins-gcm/followers","following_url":"https://api.github.com/users/jnevins-gcm/following{/other_user}","gists_url":"https://api.github.com/users/jnevins-gcm/gists{/gist_id}","starred_url":"https://api.github.com/users/jnevins-gcm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jnevins-gcm/subscriptions","organizations_url":"https://api.github.com/users/jnevins-gcm/orgs","repos_url":"https://api.github.com/users/jnevins-gcm/repos","events_url":"https://api.github.com/users/jnevins-gcm/events{/privacy}","received_events_url":"https://api.github.com/users/jnevins-gcm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-08-20T19:38:21Z","updated_at":"2018-08-21T16:02:58Z","closed_at":null,"author_association":"NONE","body":"I have a v2 Azure Function App that has an IExtensionConfigProvider that uses Autofac. When Azure Functions runtime tries to load my function app IExtensionConfigProvider, I see this exception (debugging locally)\r\n```\r\nSystem.IO.FileLoadException\r\n  HResult=0x80131621\r\n  Message=Could not load file or assembly 'Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da'.\r\n  Source=<Cannot evaluate the exception source>\r\n  StackTrace:\r\n   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)\r\n   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)\r\n```\r\n\r\nin \r\n\r\n`Microsoft.Azure.WebJobs.Script.dll!Microsoft.Azure.WebJobs.Script.Binding.ExtensionLoader.LoadCustomExtensions.AnonymousMethod__5_1(System.Reflection.Assembly assembly, string typeName, bool ignoreCase) Line 101\tC#\r\n`\r\n\r\nThere are definitely several versions of Autofac referenced by different assemblies in the mix (ranging from 4.2.2 to 4.8.1.0, but I would have expected Azure Functions to correctly resolve the highest version of Autofac correctly (which is 4.8.1.0 and is correctly in the bin directory).\r\n\r\nMy Azure Function app also has \r\n`AzureFunctionApp.deps.json\r\n`\r\nin the parent directory (because Microsoft.NET.Sdk.Functions moves dlls to a subdirectory called bin) and it looks correct, so I would not expect to have a problem here...\r\nI am using the following PackageReferences:\r\n\r\n```\r\n\r\n    <PackageReference Include=\"Microsoft.Azure.WebJobs\" Version=\"3.0.0-beta5\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"Microsoft.Azure.WebJobs.Extensions\" Version=\"3.0.0-beta5\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"Microsoft.Azure.WebJobs.Extensions.Http\" Version=\"3.0.0-beta5\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"Microsoft.Azure.WebJobs.ServiceBus\" Version=\"3.0.0-beta5\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"NLog\" Version=\"4.5.0\" />\r\n    <PackageReference Include=\"Microsoft.Extensions.DependencyInjection.Abstractions\" Version=\"2.0.0\" />\r\n    <PackageReference Include=\"Microsoft.Extensions.DependencyInjection\" Version=\"2.0.0\" />\r\n    <!-- Required only for transitive references -->\r\n    <PackageReference Include=\"Microsoft.NET.Sdk.Functions\" Version=\"1.0.*\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator\" Version=\"1.0.0-*\" PrivateAssets=\"None\" />\r\n    <PackageReference Include=\"Autofac\" Version=\"4.8.*\" />\r\n    <PackageReference Include=\"Autofac.Extensions.DependencyInjection\" Version=\"4.2.*\" />\r\n```"},"comment":{"url":"https://api.github.com/repos/Azure/Azure-Functions/issues/comments/414728069","html_url":"https://github.com/Azure/Azure-Functions/issues/916#issuecomment-414728069","issue_url":"https://api.github.com/repos/Azure/Azure-Functions/issues/916","id":414728069,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDcyODA2OQ==","user":{"login":"paulbatum","id":10663,"node_id":"MDQ6VXNlcjEwNjYz","avatar_url":"https://avatars2.githubusercontent.com/u/10663?v=4","gravatar_id":"","url":"https://api.github.com/users/paulbatum","html_url":"https://github.com/paulbatum","followers_url":"https://api.github.com/users/paulbatum/followers","following_url":"https://api.github.com/users/paulbatum/following{/other_user}","gists_url":"https://api.github.com/users/paulbatum/gists{/gist_id}","starred_url":"https://api.github.com/users/paulbatum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulbatum/subscriptions","organizations_url":"https://api.github.com/users/paulbatum/orgs","repos_url":"https://api.github.com/users/paulbatum/repos","events_url":"https://api.github.com/users/paulbatum/events{/privacy}","received_events_url":"https://api.github.com/users/paulbatum/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T16:02:57Z","updated_at":"2018-08-21T16:02:57Z","author_association":"MEMBER","body":"@jnevins-gcm I am pretty sure its because you're using out of date V2 bits locally. The version number is printed here:\r\n\r\n[08/21/2018 3:13:35 AM] Starting Host (HostId=w10dt-144893519, InstanceId=f56a5d39-b244-4908-a95a-a47a4974cef5, Version=**2.0.11651.0**, ProcessId=21180, AppDomainId=1, Debug=False, ConsecutiveErrors=0, StartupCount=1, FunctionsExtensionVersion=)\r\n\r\nThe 11651 release was in March, before we completed all the assembly resolution improvements:\r\nhttps://github.com/Azure/azure-functions-host/releases/tag/v2.0.11651-alpha\r\n\r\nThing is, VS automatically grabs the latest bits, so I'm very unclear as to why you have such an old version. Check the `%userprofile%\\AppData\\Local\\AzureFunctionsTools\\Releases\\` folder - you should see something like this (with 2.4.0 corresponding to the latest release as of time of writing).\r\n\r\n```\r\nDirectory of C:\\Users\\pbatum\\AppData\\Local\\AzureFunctionsTools\\Releases\r\n\r\n08/16/2018  10:19 AM    <DIR>          .\r\n08/16/2018  10:19 AM    <DIR>          ..\r\n05/02/2018  03:35 PM    <DIR>          1.0.11\r\n05/02/2018  05:47 PM    <DIR>          1.0.12.1\r\n06/15/2018  10:35 AM    <DIR>          1.2.0\r\n07/30/2018  04:06 PM    <DIR>          1.3.0\r\n05/02/2018  03:35 PM    <DIR>          2.0.1-beta.26\r\n05/11/2018  03:17 PM    <DIR>          2.0.1-beta.27\r\n05/22/2018  10:13 AM    <DIR>          2.1.0\r\n07/30/2018  04:06 PM    <DIR>          2.3.2\r\n08/07/2018  09:34 AM    <DIR>          2.3.3\r\n08/16/2018  10:30 AM    <DIR>          2.4.0\r\n```\r\n\r\n"}}
{"actor":{"display_login":"paulbatum"}}