[Xamarin Android构建仅在启用链接器后挂起]

问题描述 投票:0回答:1

我有一个Xamarin.Android项目,尝试在Release配置中构建解决方案时挂起。我将其范围缩小到了链接器的问题-如果链接器已关闭,则一切正常。

我已经以较高的详细程度完成了构建,甚至从命令行使用了msbuild(这表明这不是IDE问题),结果是相同的。直到挂起为止的生成输出为:

Target _LinkAssembliesShrink:
  Building target "_LinkAssembliesShrink" completely.
  Input file "obj/Preview/linksrc/BondiToManly.Android.dll" is newer than output file "obj/Preview/link.flag".
  Task "CreateProperty" skipped, due to false condition; ( '$(AndroidLinkTool)' != '' ) was evaluated as ( '' != '' ).
  Task "MakeDir" skipped, due to false condition; ( '$(AndroidLinkTool)' != '' ) was evaluated as ( '' != '' ).
  Using "LinkAssemblies" task from assembly "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Build.Tasks.dll".
  Task "LinkAssemblies"
    Processing resource linker descriptor: mscorlib.xml
    Processing resource linker descriptor: Mono.Android.xml
    Processing embedded resource linker descriptor: mscorlib.xml
    Duplicate preserve in descriptor mscorlib.xml from Xamarin.Android.Build.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null of System.AppDomain (Nothing).  Duplicate uses (Fields)
    Duplicate preserve in descriptor mscorlib.xml from Xamarin.Android.Build.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null of System.AppDomainSetup (Fields).  Duplicate uses (Fields)
    Type Mono.ValueTuple has no fields to preserve
    Type System.Reflection.Assembly has no fields to preserve
    Type System.Reflection.Emit.ByRefType has no fields to preserve
    Type System.Reflection.Emit.PointerType has no fields to preserve

并且它确实挂起,就像线程死锁之类。无法取消构建,您只需要退出IDE(类似,终端中的^ C也不执行任何操作)。

这似乎只会影响我拥有的这个Xamarin项目(许多其他具有类似配置的项目构建良好)。在这个阶段,我真的只是希望找到一种方法来了解发生了什么问题。

任何提示将不胜感激。

xamarin xamarin.android
1个回答
0
投票

这不是我的解决方案,但是出现了问题,并且在Xamarin Android GitHub项目https://github.com/xamarin/xamarin-android/issues/3852的问题列表中共享了解决方法>

此修补程序是从项目文件中删除对Nullable引用类型(<Nullable>enable</Nullable>)的明确支持。

例如,在我的具有三个配置/平台PropertyGroup的项目文件中,删除带有<Nullable>enable</Nullable>的行,例如:

@@ -29,7 +29,6 @@
     <WarningLevel>4</WarningLevel>
     <NoWarn>VSTHRD200</NoWarn>
     <LangVersion>8.0</LangVersion>
-    <Nullable>enable</Nullable>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -40,7 +39,6 @@
     <WarningLevel>4</WarningLevel>
     <NoWarn>VSTHRD200</NoWarn>
     <LangVersion>8.0</LangVersion>
-    <Nullable>enable</Nullable>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VLU1|AnyCPU'">
     <DebugSymbols>true</DebugSymbols>
@@ -52,7 +50,6 @@
     <ErrorReport>prompt</ErrorReport>
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     <LangVersion>8.0</LangVersion>
-    <Nullable>enable</Nullable>
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Microsoft.CSharp" />
© www.soinside.com 2019 - 2024. All rights reserved.