Open Closed

FileManager won't create file when no ExtensibleObject is passed #3116


User avatar
0
cezary.bojko created
  • ABP Framework version: v5.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
at Volo.Abp.Check.NotNull[T](T value, String parameterName)
   at Volo.Abp.ObjectExtending.ExtensibleObjectMapper.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable`1 definitionChecks, String[] ignoredProperties)
   at Volo.Abp.ObjectExtending.HasExtraPropertiesObjectExtendingExtensions.MapExtraPropertiesTo[TSource,TDestination](TSource source, TDestination destination, Nullable`1 definitionChecks, String[] ignoredProperties)
   at Volo.FileManagement.Files.FileManager.<SaveFileDescriptorAsync>d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Volo.FileManagement.Files.FileManager.&lt;CreateAsync&gt;d__11.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
  • Steps to reproduce the issue:"

After update from 5.1.4 to 5.2.2 I must pass optional parameter (extensibleObject) to avoid exception.

        await _fileManager.CreateAsync(errorFileName, "text/plain", new RemoteStreamContent(stream), directoryId, extensibleObject: new ExtensibleObject());
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

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

    hi

    I will check this.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Please try to override the SaveFileDescriptorAsync of Volo.FileManagement.Files.FileManager service

    protected override async Task<FileDescriptor> SaveFileDescriptorAsync(string name, string mimeType, int contentLength, Guid? directoryId, Guid? tenantId, bool overrideExisting, ExtensibleObject extensibleObject = null)
    {
        var fileDescriptor = await FileDescriptorRepository.FindAsync(name, directoryId);
    
        if (fileDescriptor != null)
        {
            if (!overrideExisting)
            {
                throw new FileAlreadyExistException(name);
            }
    
            fileDescriptor.Size = contentLength;
            extensibleObject?.MapExtraPropertiesTo(fileDescriptor);
            await FileDescriptorRepository.UpdateAsync(fileDescriptor);
        }
        else
        {
            fileDescriptor =
                new FileDescriptor(GuidGenerator.Create(), name, mimeType, directoryId, contentLength, tenantId);
            extensibleObject?.MapExtraPropertiesTo(fileDescriptor);
            await FileDescriptorRepository.InsertAsync(fileDescriptor);
        }
    
        return fileDescriptor;
    }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    cezary.bojko created

    So, is this a bug? Could I get question refund?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Refunded : )

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.