A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello @Jonathan ,
Thanks for your question.
In your screenshot, the code is doing some PDF paperwork. However, when it is done with the PDF task, it never actually builds or returns the application. The method just ends.
The compiler is throwing the CS0161 error because the factory broke its contract—the operating system is waiting for an app, but the method didn't return one.
I recommend returning statement at the very end. You can refer to following code example:
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder.UseMauiApp<App>();
// Drop your PDF testing script here for now
// string inputFilePath = @"C:\path\to\your\input.pdf";
// ... rest of the try/catch logic ...
return builder.Build();
}
// Keep the PDF helper method outside the main builder
// public static void InjectTextIntoPdf(...)
}
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.