Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Porting a .NET desktop app to macOS and Linux, and the bugs a VM didn’t show me

Описание и применение

Перенос десктопного приложения .NET на macOS и Linux выявил множество кроссплатформенных проблем, которые решены через настройку рендеринга, тултипа, локали, Dock‑сознательности, сервисов Finder, подписи кода и наблюдения за файлами.

Задача

A C# file‑converter app that worked only on Windows needed to run on macOS and Linux, but cross‑platform Avalonia revealed numerous platform‑specific bugs.

Результат

Filee now runs on macOS and Linux with full functionality, including drag gestures, locale handling, Dock‑aware gestures, Finder services, proper code signing, and robust file watching.

Рабочий процесс

  • 1. Enable 3D acceleration in VMware macOS VM to allow Avalonia’s RenderTimer.
  • 2. Set a non‑null tooltip before attaching the tray icon on macOS.
  • 3. Use CoreFoundation’s CFLocaleCopyPreferredLanguages to determine UI language and list localizations in Info.plist.
  • 4. Skip windows with layer >0 when detecting the window under the cursor to avoid the Dock.
  • 5. Implement a macOS service by registering an Objective‑C class at runtime that handles convertFiles:userData:error: and declare it in Info.plist.
  • 6. Sign all files in Contents/MacOS (including non‑Mach‑O assemblies) before signing the executable and bundle; fix CRLF in entitlements with .gitattributes.
  • 7. Extend file‑watcher logic to wait longer for file stability and skip files with creation date 24 Jan 1984 on macOS.
  • 8. Deploy on Linux with install.sh, add file‑manager actions for Nautilus, Nemo, Thunar, Dolphin; use drop window for Wayland.
  • 9. Run CI on GitHub runners to capture screenshots and verify functionality.

Доказательства

Avalonia.Native was not able to start the RenderTimer. Native error code is: -6661

Источник

System.ArgumentNullException: Value cannot be null. (Parameter 'chars') at Avalonia.Native.Interop.Impl.__MicroComIAvnTrayIconProxy.SetToolTipText(String text)

Источник

CFLocaleCopyPreferredLanguages

Источник

codesign on the main executable failed with "code object is not signed at all" pointing at Microsoft.CSharp.dll

Источник

  • Дата записи: 2026-10-10T00:55:52.801Z