Skip to content

SqlDependency.Start throws FileNotFoundException #260

Closed
@Grauenwolf

Description

Describe the bug

When running against .NET Framework 4.6.1, SqlDependency.Start(string) throws a FileNotFoundException.

Exception message:
        System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=1.0.19269.1, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5' or one of its dependencies. The system cannot find the file specified.

Stack trace:
        RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
        RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
        RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
        Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
        Activator.CreateInstance(String assemblyName, String typeName)
        AppDomain.CreateInstance(String assemblyName, String typeName)
        StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
        StackBuilderSink.SyncProcessMessage(IMessage msg)
        Exception rethrown at [0]: 
        RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
        RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
        _AppDomain.CreateInstance(String assemblyName, String typeName)
        SqlDependency.CreateProcessDispatcher(_AppDomain masterDomain)
        SqlDependency.ObtainProcessDispatcher()
        SqlDependency.Start(String connectionString, String queue, Boolean useDefaults)
        SqlDependency.Start(String connectionString)

Further technical details

<PackageReference Include="Microsoft.Data.SqlClient" Version="1.0.19269.1" />

Additional context
The same code works correctly when targeting .NET Core 2.1.

The same code works correctly when using System.Data.SqlClient against .NET Framework 4.6.1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

🐛 Bug!Issues that are bugs in the drivers we maintain.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions