Skip to content

偶尔抛出异常,原因不明,抛出异常的位置:JsonNetReturnAttribute; System.ObjectDisposedException: Cannot access a disposed object. #247

Description

@wangweinjcn

包的版本:

"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)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    等待反馈(needs feedback)这意味着需要来自发起者的反馈(This means that feedback from the author is required)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions