Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll' using 3.0.0.10-preview
See original GitHub issueDescribe the bug Running a slightly modified version of the sample application (netcoreapp3.0) using 3.0.0.10-preview. There is no exception with 3.0.0.9-preview.
var query = new CosmosSqlQueryDefinition($"select * from table s where s.{nameof(IVirtualActorDefinition.Id)} = @{nameof(IVirtualActorDefinition.Id)} ")
.UseParameter($"@{nameof(IVirtualActorDefinition.Id)}", reference.Id);
// Use the query to get the cosmos response message and access the stream directly
var streamResultSet = _container.Items.CreateItemQueryAsStream(query, 0, partitionKey: (int)reference.ActorType, maxItemCount: 10);
var resultsFromStream = new List<IVirtualActorDefinition>();
while (streamResultSet.HasMoreResults)
{
using var responseMessage = await streamResultSet.FetchNextSetAsync();
// Item stream operations do not throw exceptions for better performance
if (responseMessage.IsSuccess)
{
var results = FromStream<IVirtualActorDefinition[]>(responseMessage.Content);
_logger.LogInformation($"\n1.4.1 - Item Query via stream {results.Length}");
}
else
{
_logger.LogError($"Query item from stream failed. Status code: {responseMessage.StatusCode} Message: {responseMessage.ErrorMessage}");
}
}
the streamResultSet.FetchNextSetAsync()
throws
System.AggregateException: One or more errors occurred. (Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)) ---> System.DllNotFoundException: Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
at Microsoft.Azure.Documents.ServiceInteropWrapper.CreateServiceProvider(String configJsonString, IntPtr& serviceProvider)
at Microsoft.Azure.Cosmos.Query.QueryPartitionProvider.Initialize()
at Microsoft.Azure.Cosmos.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected, Boolean allowNonValueAggregateQuery)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.GetPartitionedQueryExecutionInfoAsync(CosmosQueryClient queryClient, SqlQuerySpec sqlQuerySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected, Boolean allowNonValueAggregateQuery, CancellationToken cancellationToken)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.CreateItemQueryExecutionContextAsync(CancellationToken cancellationToken)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.ExecuteNextAsync(CancellationToken token)
at Microsoft.Azure.Cosmos.CosmosItemsCore.QueryRequestExecutor(String continuationToken, CosmosRequestOptions requestOptions, Object state, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Microsoft.Azure.Cosmos.CosmosResultSetIteratorCore.<FetchNextSetAsync>b__7_0(Task`1 task)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
at Chorus.Common.Types.Tests.TestVirtualActorDefinition.QueryItems(IVirtualActorDefinition reference) in C:\ossiaco\dotnet\src\Chorus.Common.Types\app\Chorus.Cosmos\TestVirtualActorDefinition.cs:line 152
at Chorus.Common.Types.Tests.TestVirtualActorDefinition.RunBasicOperationsOnStronglyTypedObjects() in C:\ossiaco\dotnet\src\Chorus.Common.Types\app\Chorus.Cosmos\TestVirtualActorDefinition.cs:line 77
at System.Threading.Tasks.ValueTask`1.get_Result()
at Chorus.Common.Types.Tests.TestVirtualActorDefinition.RunItems() in C:\ossiaco\dotnet\src\Chorus.Common.Types\app\Chorus.Cosmos\TestVirtualActorDefinition.cs:line 56
at Chorus.Common.Types.Tests.TestVirtualActorDefinition.Main() in C:\ossiaco\dotnet\src\Chorus.Common.Types\app\Chorus.Cosmos\TestVirtualActorDefinition.cs:line 40
---> (Inner Exception #0) System.DllNotFoundException: Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
at Microsoft.Azure.Documents.ServiceInteropWrapper.CreateServiceProvider(String configJsonString, IntPtr& serviceProvider)
at Microsoft.Azure.Cosmos.Query.QueryPartitionProvider.Initialize()
at Microsoft.Azure.Cosmos.Query.QueryPartitionProvider.GetPartitionedQueryExecutionInfoInternal(SqlQuerySpec querySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected, Boolean allowNonValueAggregateQuery)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.GetPartitionedQueryExecutionInfoAsync(CosmosQueryClient queryClient, SqlQuerySpec sqlQuerySpec, PartitionKeyDefinition partitionKeyDefinition, Boolean requireFormattableOrderByQuery, Boolean isContinuationExpected, Boolean allowNonValueAggregateQuery, CancellationToken cancellationToken)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.CreateItemQueryExecutionContextAsync(CancellationToken cancellationToken)
at Microsoft.Azure.Cosmos.Query.CosmosQueryExecutionContextFactory.ExecuteNextAsync(CancellationToken token)
at Microsoft.Azure.Cosmos.CosmosItemsCore.QueryRequestExecutor(String continuationToken, CosmosRequestOptions requestOptions, Object state, CancellationToken cancellationToken)<---
Expected behavior No exception
Actual behavior CRASH and BOOM
Environment summary
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview6-011767
Commit: ce3e2ee3c1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview6-011767\
Host (useful for support):
Version: 3.0.0-preview6-27705-15
Commit: 19521cec63
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.600 [C:\Program Files\dotnet\sdk]
2.1.601 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
3.0.100-preview6-011734 [C:\Program Files\dotnet\sdk]
3.0.100-preview6-011767 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview6-19255-03 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview6-27705-02 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview6-27705-15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview6-27705-02 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0-preview6-27705-15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Additional context
I’m not sure why it is trying to load that dll when Microsoft.Azure.Cosmos.ServiceInterop.dll
is in the bin directory
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Unable to load DLL 'Microsoft.Azure.Documents. ...
I am using Microsoft.Azure.DocumentDB 1.17.0 in my project and getting below error. "ServiceInterop.dll" Dll is present in the folder which ...
Read more >Diagnose and troubleshoot issues when using Azure ...
If you encounter the following error: Unable to load DLL 'Microsoft.Azure.Cosmos.ServiceInterop.dll' or one of its dependencies: and are ...
Read more >Microsoft.Azure.Documents.ServiceInterop.dll'
Coding example for the question Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll' [using Microsoft.Azure.DocumentDB 1.17.0]
Read more >Azure Functions v 2.0 HttpTrigger with CosmosDB Client Tips
NetCore 2.0 based Azure Functions Environment with CosmosDB. ... Unable to load DLL 'Microsoft.Azure.Documents.ServiceInterop.dll'.
Read more >Microsoft Azure DocumentDB .NET SDK 1.9.1 Released
Azure.Documents.ServiceInterop.dll which is required while referencing to DocumentDB project with reference to DocumentDB Nuget package. Another ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s what’s happening. I’m pulling the Microsoft.Azure.Cosmos nuget package in Project A. The
Microsoft.Azure.Cosmos.ServiceInterop.dll
reference is copied to Project A’s bin. Then Project B pulls Project A’s dll.Microsoft.Azure.Cosmos.ServiceInterop.dll
is NOT copied to Project B’s bin. Even though this is annoying, the easy solution it to pull directly on the Microsoft.Azure.Cosmos nuget package in Project B.Now, Project B is a .Net 4.7.2 ASP.NET application running in IIS 10. When the application is running, IIS shadow copies the managed references from the bin folder of the application to another temporary folder on the machine. The unmanaged references like
Microsoft.Azure.Cosmos.ServiceInterop.dll
are NOT copied to those folders so the application fails runtime because it cannot find it.Simillar problem discussion : https://stackoverflow.com/questions/344608/unmanaged-dlls-fail-to-load-on-asp-net-server/4598747
Do you have any suggestions as to how to make this work in IIS?
Upgrade to 3.0.0 stable release solved this problem