dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
MIT License
842 stars 281 forks source link

Exception from HRESULT: 0x8007000B #1994

Open Patresko opened 1 year ago

Patresko commented 1 year ago

Im using Window 11 ARM with Paralles on Macbook M1 Pro.

Im not able to attach SQL server in Visual Studio.

===================================

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) (Microsoft.Data.SqlClient)

------------------------------
Program Location:

   at Microsoft.Data.SqlClient.SNINativeManagedWrapperX64.UnmanagedIsTokenRestricted(IntPtr token, Boolean& isRestricted)
   at Microsoft.Data.Win32NativeMethods.IsTokenRestrictedWrapper(IntPtr token)
   at Microsoft.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent()
   at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at Microsoft.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
   at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
   at Microsoft.VisualStudio.Data.Tools.SqlEditor.DataModel.SqlConnectionStrategy.ValidateConnection(UIConnectionInfo ci, IServerConnectionProvider server)
   at Microsoft.SqlServer.ConnectionDlg.UI.ConnectionDialogViewModel.OpenConnectionWithVerifier(IServerConnectionProvider serverConnectionProvider)
JRahnama commented 1 year ago

@Patresko is your application running for AnyCPU? Sounds like it is running in x64 while on ARM64.

Patresko commented 1 year ago

Yes I have Platform target to Any CPU But Im getting exception from above every time when Im trying to link project to the server. Also I have tried to create new .NET project and got same. Its seem there is something wrong with studio for ARM running on Mac via Parallels.

i-Screen-Shoter-Parallels-Desktop-230414114239

JRahnama commented 1 year ago

@Patresko what version of VS2022 are you using? Can you also let us know about the M.D.Sqlclient version used in your application?

Also, make sure Visual Studio is fully up to date.

Patresko commented 1 year ago

Microsoft Visual Studio Community 2022 (ARM 64-bit) - Current Version 17.5.4

Microsoft.Data.SqlClient Version 5.1.1

Devanshu-17 commented 1 year ago

@Patresko @JRahnama Hey, sorry to bump this thread but I am also facing the same problem. Were you able to figure it out?

khrizenriquez commented 6 months ago

Any update on this, im getting the same error in my local