偶尔抛出异常,原因不明,抛出异常的位置:JsonNetReturnAttribute; System.ObjectDisposedException: Cannot access a disposed object.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- backend-api-design
Research direction
Start with JsonNetReturnAttribute.SetResultAsync and follow the ApiReturnAttribute.OnResponseAsync and ApiRequestExecuter.HandleResponseAsync calls shown in the stack trace. Investigate the IServiceProvider lifetime during intermittent response handling and confirm completion by reproducing the failure and verifying that disposed-provider access no longer occurs.
Written by the indexing model from the issue text.
Description
包的版本:
"WebApiClientCore" Version="2.0.4"
"WebApiClientCore.Extensions.NewtonsoftJson" Version="2.0.4"
"WebApiClientCore.Extensions.OAuths" Version="2.0.4"
代码定义:
[ServiceName("baseDataServer", "ut")]
[apiConsoleLog]
[JsonNetReturn]
public interface iCommTestApi
{
/// <summary>
/// 按条件获取全部数据
/// </summary>
/// <param name="queryParam"></param>
/// <param name="objectName"></param>
/// <returns></returns>
[HttpPost("api/dbentityop/allRows/{objectName}/{returnFieldType}")]
Task<IList<Dictionary<string, object>>> queryRows([JsonContent] baseQueryFormModel queryParam, [PathQuery] string objectName, int returnFieldType = 0);
}
现象:
偶尔会抛出异常
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'IServiceProvider'.
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ThrowHelper.ThrowObjectDisposedException()
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at WebApiClientCore.Attributes.JsonNetReturnAttribute.SetResultAsync(ApiResponseContext context)
at WebApiClientCore.Attributes.ApiReturnAttribute.OnResponseAsync(ApiResponseContext context)
at WebApiClientCore.Implementations.ApiRequestExecuter.HandleResponseAsync(ApiResponseContext context)
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 445
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnetcore/WebApiClient
-
question 等待反馈(needs feedback)
Difficulty 5/5 Over a week Newbie friendliness 25/100
dotnetcore/WebApiClient#279 · 3 comments ·
-
question 等待反馈(needs feedback)
Difficulty 4/5 3-5 days Newbie friendliness 25/100
dotnetcore/WebApiClient#274 · 1 comment ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 30/100
dotnetcore/WebApiClient#271 · 2 comments ·
-
在原有接口方法调用上添加其他参数的方案? Open等待反馈(needs feedback)
Difficulty 5/5 Over a week Newbie friendliness 20/100
dotnetcore/WebApiClient#264 · 1 comment ·
-
new idea
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dotnetcore/WebApiClient#261 · 5 comments ·
All issues in dotnetcore/WebApiClient
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·