Open Closed

FileManagement Module Download Error from RemoteStreamContent #1096


User avatar
0
selinkoykiran created

Hello, We use FileManagement module in our project and when try to download we got error like below from RemoteStreamContent. We override the appService layer because of some needs like below :

        public async override Task<RemoteStreamContent> DownloadAsync(Guid id)
        {
            var file = await FileDescriptorRepository.GetAsync(id);
            if (file.DirectoryId == null)
            {
                throw new Exception("Directory can not be empty");
            }
            _blobContainer = _blobProviderSelector.Get((Guid)file.DirectoryId);
            var stream = await _blobContainer.GetAsync(id.ToString());
            return new RemoteStreamContent(stream);
        }

We've just changed blobContainer part the remaining part is same with 4.2.2 FileDescriptorAppService code. We tried in json type or the other file types but we think there is some issue about response header maybe ? Could you please help ? Thank you

  • ABP Framework version: v4.2.2
  • UI type:MVC
  • DB provider: EF Core
  • **Tiered (MVC) : yes
  • Exception message and stack trace:
*2021-03-24 17:25:04.140 +03:00 [ERR] Each parameter in constructor 'Void .ctor(System.IO.Stream)' on type 'Volo.Abp.Content.RemoteStreamContent' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. The match can be case-insensitive.
System.InvalidOperationException: Each parameter in constructor 'Void .ctor(System.IO.Stream)' on type 'Volo.Abp.Content.RemoteStreamContent' must bind to an object property or field on deserialization. Each parameter name must match with a property or field on the object. The match can be case-insensitive.
  at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(ConstructorInfo constructorInfo, Type parentType)
  at System.Text.Json.Serialization.Converters.ObjectWithParameterizedConstructorConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
  at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
  at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
  at System.Text.Json.JsonSerializer.ReadCore[TValue](Utf8JsonReader& reader, Type returnType, JsonSerializerOptions options)
  at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, Type returnType, JsonSerializerOptions options)
  at Volo.Abp.Json.SystemTextJson.AbpSystemTextJsonSerializerProvider.Deserialize[T](String jsonString, Boolean camelCase)
  at Volo.Abp.Json.AbpHybridJsonSerializer.Deserialize[T](String jsonString, Boolean camelCase)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.MakeRequestAndGetResultAsync[T](IAbpMethodInvocation invocation)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.GetResultAsync(Task task, Type resultType)
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.InterceptAsync(IAbpMethodInvocation invocation)
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
  at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
  at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
  at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
  at Volo.FileManagement.Files.FileDescriptorController.DownloadAsync(Guid id)
  at lambda_method1814(Closure , Object )
  at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  • Steps to reproduce the issue:

6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi selinkoykiran

    Can you share a simple project to me? liming.ma@volosoft.com

  • User Avatar
    0
    selinkoykiran created

    Hello, I sent a sample project .

    Thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @selinkoykiran

    Can you try to download Volo.FileManagement source code then change RemoteStreamContent to IRemoteStreamContent?

    abp add-module Volo.FileManagement

  • User Avatar
    0
    selinkoykiran created

    hello, So then this is a bug in FileManagement Module , right ? Will you fix it in next versions ? Because we don't want to add module directly into our project because of maintenance issues depends on version changing. I'll try anyway your answer with overriding these files in my project.

    Thank you.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes It will be fixed in 4.3.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38