I've gone completely around the problem by pushing the memory stream directly to the PDF viewer and skipping the save step. but in doing so I noticed something strange, even though I have a community license a header appears indicating that my instance of PDF is a trial version, what gives??????
so your application on my system (VS 2019 with all of the latest updates applied) failed with these 3 errors: also Forms.Context is obsolete, not sure what that's doing to the app and public async Task SaveAndView(string fileName, String contentType, MemoryStream stream) throws and error as there is no await. Does this really save to the root ( Xamarin.Forms.DependencyService.Get().SaveAndView("Output.pdf", "application/pdf", stream);) And then attempt to read from the Assets folder. shouldn't it be something like Xamarin.Forms.DependencyService.Get().SaveAndView("/Assets/Output.pdf", "application/pdf", stream);?
Severity Code Description Project File Line Suppression State
Error CS1566 Error reading resource 'GettingStarted.Assets.sample.pdf' -- 'Could not find file 'C:\Users\johnw\Downloads\Sample_xamarin-1505448411\Sample_xamarin\GettingStarted\GettingStarted\GettingStarted\Assets\sample.pdf'.' GettingStarted C:\Users\johnw\Downloads\Sample_xamarin-1505448411\Sample_xamarin\GettingStarted\GettingStarted\GettingStarted\CSC 1 Active
Severity Code Description Project File Line Suppression State
Error The "LinkAssemblies" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'GettingStarted.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'GettingStarted.Android.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() GettingStarted.Android
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Users\johnw\Downloads\Sample_xamarin-1505448411\Sample_xamarin\GettingStarted\GettingStarted\GettingStarted\bin\Debug\netstandard2.0\GettingStarted.dll'.
File name: 'C:\Users\johnw\Downloads\Sample_xamarin-1505448411\Sample_xamarin\GettingStarted\GettingStarted\GettingStarted\bin\Debug\netstandard2.0\GettingStarted.dll'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at Xamarin.Android.Tools.Files.HashFile(String filename, HashAlgorithm hashAlg)
at Xamarin.Android.Tools.Files.HashFile(String filename)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() GettingStarted.Android