Could not load file or assembly Microsoft.Identity.Client, Version=4.22.0.0
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 需要釐清
- 活躍度
- 停滯
- 領域
- databases, testing-qa
研究方向
先重現 SqlAgentService.ExecuteJob 周圍失敗的測試,並檢查獨立 .NET 4.8 測試專案的 app.config 和套件參考。比較測試專案與 Microsoft.SqlServer.SqlManagementObjects 所解析的 Microsoft.Identity.Client 版本,然後確認測試不再引發組件載入錯誤。
由索引模型根據 Issue 內容生成。
描述
I have a .NET 4.8 framework Windows application that is using Microsoft.SqlServer.SqlManagementObjects (v161.47027.0) in its own class. I am unit testing that class in a separate .NET 4.8 library test project.
However when I run a test like so:
[Test]
public void SqlAgentJobDoesntExist_ThrowsException()
{
var connection = new SqlConnectionStringBuilder(ConnectionString); //ConnectionString coming from app.config in the test project
var sqlAgent = new SqlAgentService(connection);
Assert.Throws<NullReferenceException>(() => { var result = sqlAgent.ExecuteJob("NotFound"); });
}
It is throwing an error around this bit of code in my service class:
public CompletionResult ExecuteJob(string jobName)
{
try
{
var connection = new ServerConnection(_connectionBuilder.DataSource, _connectionBuilder.UserID, _connectionBuilder.Password);
var server = new Server(connection);
var job = server.JobServer.Jobs[jobName]; //<-- throwing error here
...
Error:
Microsoft.SqlServer.Management.Common.ConnectionFailureException : Failed to connect to server XXXXXXXXXXX.
----> System.TypeInitializationException : The type initializer for 'Microsoft.Data.SqlClient.SqlAuthenticationProviderManager' threw an exception.
----> System.IO.FileLoadException : Could not load file or assembly 'Microsoft.Identity.Client, Version=4.22.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Two reasons this is odd:
- The application itself is working fine (the main project), this error is only happening in my unit test project
- It's odd because SMO already installs Microsoft.Identity.Client as a dependency when adding as a NuGet package. Why is it asking for this older 4.22 version?
- 主要語言
- C#
- 星號
- 143
- 分支
- 29
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/sqlmanagementobjects 的其他 Issue
-
Path parsing functions are incorrect when running on Linux可能已有人在做 @shueybubbles 於 4 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 62/100
-
難度 3/5 1-2 天 新手友好度 72/100
-
難度 4/5 3-5 天 新手友好度 74/100
-
難度 3/5 1-2 天 新手友好度 78/100
查看 microsoft/sqlmanagementobjects 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
PCL-Community/PCL-CE#3652 ·
維護者通常 1 天內回覆
-
area:frontend bug FE P3
難度 2/5 1-3 小時 新手友好度 68/100
klasolsson81/jobbliggaren#2010 ·
維護者通常 1 天內回覆
-
agentic-workflows untriaged
難度 1/5 1 小時以內 新手友好度 65/100
維護者通常 1 天內回覆
-
area: homeblaze type: bug
難度 2/5 1-3 小時 新手友好度 74/100
RicoSuter/Namotion.Interceptor#630 ·
維護者通常 1 天內回覆
-
Akka.Hosting enhancement
難度 2/5 1-3 小時 新手友好度 65/100