Browse Source

NativeDependencyProvider: added simple debugging

Marcin Ziąbek 10 months ago
parent
commit
e7727e24f2

+ 28 - 0
Source/QuestPDF.Companion.TestRunner/Program.cs

@@ -8,6 +8,34 @@ using QuestPDF.ReportSample.Layouts;
 
 Settings.License = LicenseType.Professional;
 
+while (true)
+{
+    Document
+        .Create(container =>
+        {
+            container.Page(page =>
+            {
+                var clampText = Placeholders.LoremIpsum();
+                
+                page.Content()
+                    .PaddingVertical(1, Unit.Centimetre)
+                    .Column(column =>
+                    {
+                        foreach (var i in Enumerable.Range(0, 100_000))
+                        {
+                            column.Item()
+                                .Text(Placeholders.Paragraph())
+                                .FontSize(20)
+                                .ClampLines(4, "1234567890");
+                        }
+                    });
+            });
+        })
+        .GeneratePdf();
+    
+    Console.WriteLine("-");
+}
+
 //await RunGenericException();
 //await RunLayoutError();
 await RunSimpleDocument();

+ 1 - 0
Source/QuestPDF.Companion.TestRunner/QuestPDF.Companion.TestRunner.csproj

@@ -5,6 +5,7 @@
         <TargetFramework>net8.0</TargetFramework>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
+        <ServerGarbageCollection>true</ServerGarbageCollection>
     </PropertyGroup>
 
     <ItemGroup>

+ 6 - 0
Source/QuestPDF/Helpers/NativeDependencyProvider.cs

@@ -22,12 +22,15 @@ internal static class NativeDependencyProvider
     public static void EnsureNativeFileAvailability()
     {
         var nativeFilesPath = GetNativeFileSourcePath();
+        Console.WriteLine($"Native files source: {nativeFilesPath}");
         
         if (nativeFilesPath == null)
             return;
 
         foreach (var nativeFilePath in Directory.GetFiles(nativeFilesPath))
         {
+            Console.WriteLine($"Copying native file: {nativeFilePath}");
+            
             var targetDirectory = new FileInfo(nativeFilePath)
                 .Directory
                 .Parent // native
@@ -49,6 +52,7 @@ internal static class NativeDependencyProvider
     static string? GetNativeFileSourcePath()
     {
         var platform = GetRuntimePlatform();
+        Console.WriteLine($"Detected platform: {platform}");
 
         var availableLocations = new[]
         {
@@ -67,6 +71,8 @@ internal static class NativeDependencyProvider
 
             var nativeFileSourcePath = Path.Combine(location, "runtimes", platform, "native");
 
+            Console.WriteLine($"Trying access potential native file location: {nativeFileSourcePath}");
+            
             if (Directory.Exists(nativeFileSourcePath))
                 return nativeFileSourcePath;
         }