Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[NativeAOT] [MetaData] on Application class missing from manifest

オープン
#13,175 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, csharp

調査の方向性

Start with ComponentElementBuilder.cs, especially UpdateApplicationElement, which the issue identifies as copying application properties without writing component.MetaData. Compare the generated manifests for the repro with PublishAot=false and PublishAot=true; both Value and Resource metadata should appear on the Application class in the NativeAOT manifest.

索引モデルが issue の本文から書いたものです。

説明

Area: App+Library Build needs-triage
Android framework version

net11.0-android (Preview)

Affected platform version

.NET SDK 11.0.100-rc.2.26504.105

Description

While testing NativeAOT, I noticed that [MetaData] attributes on my Application class aren't included in the generated AndroidManifest.xml. The same attributes work with the default CoreCLR configuration.

This caused Google Maps to crash with “API key not found”, even though the key is declared on the Application class.

I've attached a small repro without any Google Maps dependency. Both Value and Resource metadata are affected. Metadata on an Activity, at assembly scope, or written directly in AndroidManifest.xml works.

I also tried CoreCLR with AndroidTypeMapImplementation=trimmable, which has the same problem.

It looks like UpdateApplicationElement copies the application properties but doesn't write component.MetaData:
https://github.com/dotnet/android/blob/801f9ecbab5118b13d21cb52409e507ad4b2feb7/src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/ComponentElementBuilder.cs#L238-L249

Steps to Reproduce
  1. Extract the ManifestMetadataRepro.zip into two separate folders.
  2. In the first folder, run:
    dotnet publish -c Release -r android-arm64 -p:PublishAot=false
    
  3. In the second folder, run:
    dotnet publish -c Release -r android-arm64 -p:PublishAot=true
    
  4. Compare obj/Release/net11.0-android/android-arm64/android/AndroidManifest.xml from both folders.

The CoreCLR manifest contains repro.application.value and repro.application.resource. Both are missing from the NativeAOT manifest, although both builds succeed.

Did you find any workaround?

Moving the attributes to assembly scope works:

[assembly: MetaData("repro.application.value", Value = "application-present")]
[assembly: MetaData("repro.application.resource", Resource = "@string/repro_value")]

Declaring the entries directly in AndroidManifest.xml also works.

主要言語
C#
スター
2.1k
フォーク
581
平均マージ
1日 15時間
マージ済み PR(30日)
228

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/android のほかの issue

dotnet/android の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。