Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] skip _FindLayoutsToBind when feature is…
Browse files Browse the repository at this point in the history
… unused

Context: xamarin#4187

We have been able to repro a hang when using ReSharper +
Xamarin.Android with this stack trace:

    Xamarin.Build.AsyncTask.dll!Xamarin.Build.AsyncTask.WaitForCompletion() Line 285
    Xamarin.Build.AsyncTask.dll!Xamarin.Build.AsyncTask.Execute() Line 226
    Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.AndroidAsyncTask.RunTask()
    Xamarin.Android.Build.Tasks.dll!Xamarin.Android.Tasks.AndroidAsyncTask.Execute()

This is happening inside the `<CalculateLayoutCodeBehind/>` MSBuild
task.

Using ReSharper's special "new class" dialog, a design-time build
causes the UI to lock up in VS.

PR xamarin#4187 does not fully solve the problem, however the problem *does*
go away if I make `_FindLayoutsToBind` conditional.

`_FindLayoutsToBind` can be completely skipped if you aren't using the
new code-behind features in Xamarin.Android.

This is a good fix for now to cover most Xamarin.Android projects, and
we can revisit `<CalculateLayoutCodeBehind/>` at a later time.
  • Loading branch information
jonathanpeppers committed Jan 30, 2020
1 parent 959ef4b commit 8c10eff
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -1462,7 +1462,8 @@ because xbuild doesn't support framework reference assemblies.
</ItemGroup>
</Target>

<Target Name="_FindLayoutsForBinding" Condition=" '$(Language)' == 'C#' ">
<Target Name="_FindLayoutsForBinding"
Condition=" '$(Language)' == 'C#' And ('$(AndroidGenerateLayoutBindings)' == 'True' Or '@(AndroidBoundLayout)' != '') ">
<FindLayoutsToBind
GenerateLayoutBindings="$(AndroidGenerateLayoutBindings)"
BoundLayouts="@(AndroidBoundLayout)"
Expand Down

0 comments on commit 8c10eff

Please sign in to comment.