Skip to content

Debug type has to be changed in release mode #9976

Open
@SurajImmanuel

Description

@SurajImmanuel

Description

After upgrading to MAUI 9 , DebugType had to be changed to portable and AndroidLinkMode has to be set to false since it trims the class of nuget packages that i added and it throws class not found exception.

Property which worked in MAUI 8 ,

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net9.0-android|AnyCPU'">
      		<AndroidPackageFormat>apk</AndroidPackageFormat>
      		<WarningLevel>1</WarningLevel>
      		<DebugType>pdbonly</DebugType>
      		<Optimize>true</Optimize>
      		<OutputPath>bin\Release\</OutputPath>
      		<DefineConstants>TRACE</DefineConstants>
      		<ErrorReport>prompt</ErrorReport>
      		<WarningLevel>4</WarningLevel>
      		<AndroidLinkMode>
      		<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
      		<DebugSymbols>False</DebugSymbols>
      		<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
      		<JavaMaximumHeapSize>4G</JavaMaximumHeapSize>
      		<Debugger>.Net (Xamarin)</Debugger>
      		<AotAssemblies>false</AotAssemblies>
      		<EnableLLVM>false</EnableLLVM>
      		<BundleAssemblies>false</BundleAssemblies>
      		<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
      		<AndroidSupportedAbis>armeabi-v7a;x86_64;x86;arm64-v8a</AndroidSupportedAbis>
      		<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
      		<AndroidLinkTool>r8</AndroidLinkTool>
      		<RunAOTCompilation>False</RunAOTCompilation>
      	</PropertyGroup>

current nuget packages that i have ,

<ItemGroup>
	<PackageReference Include="CommunityToolkit.Maui" Version="11.1.0" />
	<PackageReference Include="CommunityToolkit.Maui.Core" Version="11.1.0" />
	<PackageReference Include="CommunityToolkit.Maui.Markup" Version="5.1.0" />
	<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
	<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.2" />
	<PackageReference Include="Microsoft.Identity.Client" Version="4.69.1" />
	<PackageReference Include="Microsoft.IdentityModel.Logging" Version="8.6.0" />
	<PackageReference Include="Microsoft.IdentityModel.LoggingExtensions" Version="8.6.0" />
	<PackageReference Include="Microsoft.Maui.Controls.Core" Version="9.0.40" />
	<PackageReference Include="Microsoft.Maui.Core" Version="9.0.40" />
	<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.40" />
	<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.40" />
	<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
	<PackageReference Include="OnScreenSizeMarkup.Maui" Version="3.0.18" />
	<PackageReference Include="Plugin.CurrentActivity" Version="2.1.0.4" />
	<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="9.0.40" />
	<PackageReference Include="Scandit.DataCapture.Barcode.Maui" Version="7.1.0" />
	<PackageReference Include="Scandit.DataCapture.Core.Maui" Version="7.1.0" />
	<PackageReference Include="SkiaSharp.Extended.UI.Maui" Version="2.0.0" />
	<PackageReference Include="Zebra.Printer.SDK" Version="3.0.3337" />
	<PackageReference Include="ZXing.Net.Maui" Version="0.4.0" />
	<PackageReference Include="ZXing.Net.Maui.Controls" Version="0.4.0" />
</ItemGroup>

Steps to Reproduce

  1. Use the Item group and Property group in csproj
  2. Run the project in release mode .

Link to public reproduction project repository

No response

Version with bug

9.0.50 SR5

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.100 SR10

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-infoIssues that need more information from the author.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions