[CSHARP-2016] Azure Functions not compatible with 2.4.4 Created: 13/Jul/17  Updated: 09/Jan/18  Resolved: 09/Jan/18

Status: Closed
Project: C# Driver
Component/s: Testing
Affects Version/s: 2.4.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Raphael Londner Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 10 Enterprise 14393.1480
Visual Studio 2017 Community Edition 15.3.0 Preview 4.0
Existing Microsoft Azure account


Attachments: Zip Archive CreateMongoDBDoc.zip    
Issue Links:
Depends
depends on CSHARP-2033 Update dependency on System.Runtime.I... Closed
Duplicate
duplicates CSHARP-2033 Update dependency on System.Runtime.I... Closed

 Description   

Follow https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-your-first-function-visual-studio for the full setup of VS 2017 with Azure Functions

Try to run the attached project locally. When calling the function, the following error is generated:

```json

{"id":"3003c9cc-40e8-4439-b45d-48d9d59ef1b3","requestId":"e5cd7ecc-6bbf-41a5-aa87-ca3bdc3b6139","statusCode":500,"errorCode":0,"messsage":"Exception while executing function: Functions.HttpTriggerCSharp -> Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.","errorDetails":"Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.HttpTriggerCSharp ---> System.IO.FileNotFoundException : Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.\r\n at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateOSDocument()\r\n at System.Lazy`1.CreateValue()\r\n at System.Lazy`1.LazyInitValue()\r\n at System.Lazy`1.get_Value()\r\n at MongoDB.Driver.Core.Connections.ClientDocumentHelper.CreateClientDocument(String applicationName)\r\n at MongoDB.Driver.Core.Connections.BinaryConnectionFactory..ctor(ConnectionSettings settings,IStreamFactory streamFactory,IEventSubscriber eventSubscriber)\r\n at MongoDB.Driver.Core.Configuration.ClusterBuilder.BuildCluster()\r\n at MongoDB.Driver.ClusterRegistry.CreateCluster(ClusterKey clusterKey)\r\n at MongoDB.Driver.ClusterRegistry.GetOrCreateCluster(ClusterKey clusterKey)\r\n at MongoDB.Driver.MongoClient..ctor(MongoClientSettings settings)\r\n at MongoDB.Driver.MongoClient..ctor()\r\n at async CreateMongoDBDoc.CreateDocFunction.Run(HttpRequestMessage req,TraceWriter log)\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at async Microsoft.Azure.WebJobs.Script.Description.FunctionInvokerBase.Invoke(Object[] parameters)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.InvokeAsync[TReflected](Object[] arguments)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,Object[] invokeParameters,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,IReadOnlyDictionary`2 parameters,TraceWriter traceWriter,ILogger logger,CancellationTokenSource functionCancellationTokenSource)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) \r\n End of inner exception\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n at async Microsoft.Azure.WebJobs.JobHost.CallAsyncCore(MethodInfo method,IDictionary`2 arguments,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary`2 arguments,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ProcessRequestAsync(HttpRequestMessage request,FunctionDescriptor function,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.<ExecuteAsync>b__0(??)\r\n at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)"}

```

If you revert to 2.3 of the MongoDB driver, the function works fine (and connects to an Atlas)



 Comments   
Comment by Daniel Nauck [ 21/Sep/17 ]

The problem here is a wrong NuGet dependency definition, see my comment in CSHARP-2033

You can temp. fix this with an assembly redirect.

Comment by Robert Stam [ 05/Sep/17 ]

Based on the exception thrown a fix to CSHARP-2033 would also resolve this issue.

Comment by Raphael Londner [ 13/Jul/17 ]

Would love to get fix to avoid having to advise driver downgrade in planned Azure/Atlas blog post (ETA end of July 2017)

Generated at Wed Feb 07 21:41:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.