From 7884fb3ec613c5d22203d119d2aa9766e0fbc279 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
<1005065+DeepDiver1975@users.noreply.github.com>
Date: Mon, 31 Aug 2026 08:55:00 +0200
Subject: [PATCH 1/2] build: enable all .NET analyzers in every build
(AnalysisMode=All)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
---
Directory.Build.props | 1 +
1 file changed, 1 insertion(+)
diff --git a/Directory.Build.props b/Directory.Build.props
index a2ad604..7f9446a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -5,6 +5,7 @@
enable
enable
true
+ All
true
From ffff02a2ca17fcb72df2f3ebae19916361e6892f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?=
<1005065+DeepDiver1975@users.noreply.github.com>
Date: Mon, 31 Aug 2026 09:06:02 +0200
Subject: [PATCH 2/2] fix: scope Android platform-lifecycle analyzer noise for
AnalysisMode=All
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
---
.editorconfig | 10 ++++++++++
src/LageBuch.App.Android/MainActivity.cs | 8 ++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 0676743..697191c 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -28,3 +28,13 @@ dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.CA2008.severity = none
dotnet_diagnostic.CA1829.severity = none
dotnet_diagnostic.CA2213.severity = none
+
+[{src/LageBuch.App.Android/*.cs,src/LageBuch.App.Android/**/*.cs}]
+# Java-managed objects (Intent, Java.IO.File, ActivityResultLauncher, ActivityResultContracts.*)
+# have their lifetime owned by the Android runtime: they must survive past the C# call that hands
+# them to the platform (StartActivity / RegisterForActivityResult), so "dispose" here would break
+# the OS callbacks. MimeTypeOf likewise deliberately produces lowercase MIME values, which
+# Intent.SetDataAndType expects — ToUpperInvariant (CA1308) would violate that contract.
+dotnet_diagnostic.CA1308.severity = none
+dotnet_diagnostic.CA2000.severity = none
+dotnet_diagnostic.CA2213.severity = none
diff --git a/src/LageBuch.App.Android/MainActivity.cs b/src/LageBuch.App.Android/MainActivity.cs
index 21d06b6..eb928bc 100644
--- a/src/LageBuch.App.Android/MainActivity.cs
+++ b/src/LageBuch.App.Android/MainActivity.cs
@@ -21,6 +21,11 @@ namespace LageBuch.App.Android;
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity
{
+ // OpenDocument (rather than GetContent) accepts multiple MIME types on Launch, needed
+ // since an attachment can be any of several image types or a PDF.
+ private static readonly string[] AttachmentMimeTypes =
+ ["image/jpeg", "image/png", "image/gif", "image/webp", "application/pdf"];
+
private ActivityResultLauncher? _importLauncher;
private ActivityResultLauncher? _attachmentLauncher;
private AndroidFileDialogService? _dialogs;
@@ -51,8 +56,7 @@ protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
_dialogs = new AndroidFileDialogService(this);
_dialogs.OnLaunchImportPicker = () => _importLauncher!.Launch("application/json");
- _dialogs.OnLaunchAttachmentPicker = () => _attachmentLauncher!.Launch(
- new[] { "image/jpeg", "image/png", "image/gif", "image/webp", "application/pdf" });
+ _dialogs.OnLaunchAttachmentPicker = () => _attachmentLauncher!.Launch(AttachmentMimeTypes);
SharedApp.CreateMainViewModel = () => CompositionRoot.CreateMainWindowViewModel(
new IncidentStore(),
new MasterDataProvider(AndroidAppPaths.MasterDataDbPath(this)),