我使用PreEmptive Dotfuscator来模糊我的Android平台Xamarin Forms应用程序。我可以更早地构建应用程序,但当我将Windows升级到10,将VS升级到2019,并使用最新版本的Dotfucator Community版本时,相同的DotfuscatorConfig.xml开始出现异常。
如果我从DotfuscatorConfig.xml文件中删除根检查,我就可以成功构建
以下是带有异常详细信息的VS输出:
2> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛嬝丟吡䴣吥䜧䐩䄫䬭帯䘱` which can't be resolved. (TaskId:285)
2> Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Type[])' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛圝漟డ琣䜥尧䈩` which can't be resolved. (TaskId:285)
2> Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Type[])' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2> Reflection call 'System.Type System.Type::GetType(System.String)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' was detected with type name `䌏欑朓戕紗眙㈛圝漟డ戣伥䐧伩` which can't be resolved. (TaskId:285)
2> Reflection call 'System.Reflection.MethodInfo System.Type::GetMethod(System.String,System.Reflection.BindingFlags)' inside 'System.Boolean PreEmptive.SoS.Runtime.XRFinder::XRFind()' does not use detectable instance type extraction (TaskId:285)
2>MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "C:UsersWinUserAppDataLocalTemp" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
2>MSBUILD : error MSB4166: C:UsersWinUserAppDataLocalTempMSBuild_pid-1412_8a13e9d544e74c94b378a56e64d81b58.failure.txt:
2>MSBUILD : error MSB4166: UNHANDLED EXCEPTIONS FROM PROCESS 1412:
2>MSBUILD : error MSB4166: =====================
2>MSBUILD : error MSB4166: 7/9/2020 11:46:12 AM
2>MSBUILD : error MSB4166: System.Text.EncoderFallbackException: Unable to translate Unicode character uDDA3 at index 235 to specified code page.
2>MSBUILD : error MSB4166: at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
2>MSBUILD : error MSB4166: at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
2>MSBUILD : error MSB4166: at System.Text.UTF8Encoding.GetByteCount(Char* chars, Int32 count, EncoderNLS baseEncoder)
2>MSBUILD : error MSB4166: at System.Text.UTF8Encoding.GetByteCount(String chars)
2>MSBUILD : error MSB4166: at System.IO.BinaryWriter.Write(String value)
2>MSBUILD : error MSB4166: at Microsoft.Build.Framework.BuildEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166: at Microsoft.Build.Framework.LazyFormattedBuildEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166: at Microsoft.Build.Framework.BuildMessageEventArgs.WriteToStream(BinaryWriter writer)
2>MSBUILD : error MSB4166: at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(ITranslator translator)
2>MSBUILD : error MSB4166: at Microsoft.Build.Shared.LogMessagePacketBase.Translate(ITranslator translator)
2>MSBUILD : error MSB4166: at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.RunReadLoop(Stream localReadPipe, Stream localWritePipe, ConcurrentQueue`1 localPacketQueue, AutoResetEvent localPacketAvailable, AutoResetEvent localTerminatePacketPump)
你必须注意到最初日志中的汉字——我想知道这是否是问题的原因。
我是Dotfuscator团队的成员,并以该身份回答问题。
这看起来是Xamarin Android链接器最近更新后引入的一个新问题。我们正在内部调查,但目前,您可以禁用链接器:
- 在Visual Studio中,右键单击解决方案资源管理器中的Android项目,然后选择属性
- 转到Android选项
- 向下滚动至链接器属性
- 在链接下拉列表中,选择无
(等效的MSBuild属性为AndroidLinkMode
,设置为None
。(
如果使用此设置进行构建,则应该能够再次注入根检查。
更新:我们已经就此向Xamarin链接器团队提交了一个问题。再次感谢您引起我们的注意。