Несколько вещей:
- #if DEBUG работает правильно
- Console.WriteLine() успешно выводит данные на терминал (но по какой-то причине записывает дважды)
- Debugger.IsAttached выводит True
- Trace.WriteLine() тоже НЕ работает
Код: Выделить всё
namespace MauiApp;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
.UseSkiaSharp()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("SF-Pro.ttf", "SF-Pro");
fonts.AddFont("Font Awesome 6 Duotone-Solid-900.otf", "Font Awesome 6 Duotone");
fonts.AddFont("Font Awesome 6 Pro-Regular-400.otf", "Font Awesome 6 Regular");
fonts.AddFont("Font Awesome 6 Pro-Light-300.otf", "Font Awesome 6 Light");
}).ConfigureEssentials(essentials =>
{
essentials.UseVersionTracking();
});
#if DEBUG
// builder.Logging.AddDebug();
builder.Services.AddLogging(configure => {
configure.AddDebug();
});
Console.WriteLine("--- is debugger attached -------------------------------------");
Console.WriteLine(Debugger.IsAttached);
Console.WriteLine("----------------------------------------");
Debug.WriteLine("This is a debug write line test.");
Trace.WriteLine("This is a trace write line test.");
#endif
return builder.Build();
}
}

Вывод терминала

Подробнее здесь: https://stackoverflow.com/questions/784 ... ode-on-mac