Failed to map view of file to access individual file content

Hi,

Wondering what the error code from this error message is referring to? What could this error be?

FILE_RECORD::MapFileContent(465): Failed to map view of file to access individual file content (Path:“\bin\Aspose.PDF.dll” Err:0x80070008)

I can try to provide more information but posting this to start with.

Thanks!

Yes, of course, we need more information.

  • first of all, what product are you using ( Aspose.PDF for .NET or Java or C++) and what version
  • please provide the code used and attach the data with which this happens so that we can reproduce it.

We are using
Aspose.PDF API’s for .NET version 24.1.0

Azure Function runtime is reporting below errors and exception from ASPOSE.PDF.dll and then the function app worker process crashes . Can you let us know why we would get these errors from Aspose.PDF.dll and what is the error code 0x80070008 ?

WE are running with config WEBSITE_RUN_FROM_PACKAGE=1 and the following exceptions are thrown by Aspose when trying to access individual file ASpose.PDF.DLL : 1)
‘FILE_RECORD::MapFileContent(465): Failed to map view of file to access individual file content (Path:“\bin\Aspose.PDF.dll” Err:0x80070008)’
2) Exception call stack
System.IO.IOException : The handle is invalid. : ‘C:\home\site\wwwroot\bin\Aspose.PDF.dll’ at System.IO.RandomAccess.ReadAtOffset(SafeFileHandle handle,Span1 buffer,Int64 fileOffset) at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.ExecuteInternal() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore1.ThrowForFailedGetResult(Int16 token) at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.GetResult(Int16 token) at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token) at async System.IO.Stream.g__Core|29_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async System.IO.Strategies.BufferedFileStreamStrategy.CopyToAsyncCore(Stream destination,Int32 bufferSize,CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.AddFile(??) at //src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 66 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.InternalAddDirectory(ZipArchive zipArchive,DirectoryInfoBase directory,String directoryNameInArchive,IList1 files) at /_/src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 33 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.AddDirectory(ZipArchive zipArchive,DirectoryInfoBase directory,String directoryNameInArchive) at /_/src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 17 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass11_0.b__0(??) at /_/src/WebJobs.Script.WebHost/Controllers/FunctionsController.cs : 235 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|30_0[TFilter,TFilterAsync](??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next,Scope& scope,Object& state,Boolean& isCompleted) at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|28_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next,Scope& scope,Object& state,Boolean& isCompleted) at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(??) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware.Invoke(HttpContext context) at /_/src/WebJobs.Script.WebHost/Middleware/FunctionInvocationMiddleware.cs : 41 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Datadog.Trace.ClrProfiler.CallTarget.Handlers.Continuations.TaskContinuationGenerator3.SyncCallbackHandler.ContinuationAction[TIntegration,TTarget,TReturn](Task previousTask,TTarget target,CallTargetState state) at c:\mnt\tracer\src\Datadog.Trace\ClrProfiler\CallTarget\Handlers\Continuations\TaskContinuationGenerator.cs : 113 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.Middleware.ExceptionMiddleware.Invoke(HttpContext context) at //src/WebJobs.Script.WebHost/Middleware/ExceptionMiddleware.cs : 27

From Azure support:
Please check with your developer team, we don’t have much information about this error and error code 0x80070008. As you mentioned, the error happens right before worker process crash. I think you should fix this issue first.

@dchug
I have aligned the StackTrace you provided.
It shows that the library is not working - there is some kind of system problem with opening the library file (probably for mapping into memory). To check this, you can substitute some other dll library and check whether the same error remains.

System.IO.IOException : The handle is invalid. : ‘C:\home\site\wwwroot\bin\Aspose.PDF.dll’
at System.IO.RandomAccess.ReadAtOffset(SafeFileHandle handle,Span1 buffer,Int64 fileOffset)
at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.ExecuteInternal()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore1.ThrowForFailedGetResult(Int16 token)
at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.GetResult(Int16 token)
at Microsoft.Win32.SafeHandles.SafeFileHandle.ThreadPoolValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at async System.IO.Stream.g__Core|29_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async System.IO.Strategies.BufferedFileStreamStrategy.CopyToAsyncCore(Stream destination,Int32 bufferSize,CancellationToken cancellationToken)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.AddFile(??)
at //src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 66
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.InternalAddDirectory(ZipArchive zipArchive,DirectoryInfoBase directory,String directoryNameInArchive,IList1 files)
at //src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 33
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Extensions.ZipArchiveExtensions.AddDirectory(ZipArchive zipArchive,DirectoryInfoBase directory,String directoryNameInArchive)
at /
/src/WebJobs.Script.WebHost/Extensions/ZipArchiveExtensions.cs : 17
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass11_0.b__0(??)
at //src/WebJobs.Script.WebHost/Controllers/FunctionsController.cs : 235
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|30_0TFilter,TFilterAsync
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next,Scope& scope,Object& state,Boolean& isCompleted)
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|28_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next,Scope& scope,Object& state,Boolean& isCompleted)
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(??)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Middleware.FunctionInvocationMiddleware.Invoke(HttpContext context)
at /
/src/WebJobs.Script.WebHost/Middleware/FunctionInvocationMiddleware.cs : 41
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Datadog.Trace.ClrProfiler.CallTarget.Handlers.Continuations.TaskContinuationGenerator3.SyncCallbackHandler.ContinuationAction[TIntegration,TTarget,TReturn](Task previousTask,TTarget target,CallTargetState state)
at c:\mnt\tracer\src\Datadog.Trace\ClrProfiler\CallTarget\Handlers\Continuations\TaskContinuationGenerator.cs : 113 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at async Microsoft.Azure.WebJobs.Script.WebHost.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
at //src/WebJobs.Script.WebHost/Middleware/ExceptionMiddleware.cs : 27