Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails first time after layout file changed and saved #2427

Closed
rihadavid opened this issue Nov 11, 2018 · 46 comments
Closed

Build fails first time after layout file changed and saved #2427

rihadavid opened this issue Nov 11, 2018 · 46 comments
Assignees
Labels
bug Component does not function as intended.

Comments

@rihadavid
Copy link

Sometimes when I want to build and debug my project, it fails without any error in Output windows or in log files. Next time it works without issues.

This is how my output window looks:

1>------ Build started: Project: MyApp.Android, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

And that's it. Note that I have it on a diagnostic verbosity.

Please let me know what can I do to get you more info, it's happening quite often, but conditions are unknown.

Version Information

Microsoft Visual Studio Community 2017 
Version 15.8.9
VisualStudio.15.Release/15.8.9+28010.2050
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Community

ASP.NET and Web Tools 2017   15.8.05085.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   15.8.31590
Provides languages services for ASP.NET Core Razor.

AWS Toolkit for Visual Studio 2017   1.14.4.1
AWS Toolkit for Visual Studio 2017.
Copyright 2011-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws-vs-toolkit.s3.amazonaws.com/versioninfo.html

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License 
  [http://logging.apache.org/log4net/license.html]
- Putty for PPK to PEM conversion, MIT license 
  [http://www.chiark.greenend.org.uk/~sgtatham/putty/licence.html]
- NGit for AWS Elastic Beanstalk incremental push
  [https://github.com/mono/ngit/blob/master/NGit.license.txt]
- NSch dependency for NGit
  [https://github.com/mono/ngit/blob/master/NSch.license.txt]
- Sharpen dependency for NGit
  [https://github.com/mono/ngit/blob/master/Sharpen/AssemblyInfo.cs]
- ICSharpCode.SharpZipLib dependency for NGit
  [http://www.icsharpcode.net/opensource/sharpziplib/]
- Mono.Posix.dll and Mono.Security.dll dependencies for NGit
  [http://mono-project.com/FAQ:_Licensing#Licensing]
- MPFProj for Visual Studio Project Framework
  [http://mpfproj10.codeplex.com/license]
- JSON Checker for JSON validation
  [http://www.raboof.com/projects/jsonchecker/]
- Newtonsoft Json.NET
  [http://www.newtonsoft.com/json] 
- YamlDotNet
  [http://aaubry.net/pages/yamldotnet.html] 
    

C# Tools   2.9.0-beta8-63208-01
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Mono Debugging for Visual Studio   4.11.11-pre (8fb558f)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

Visual Basic Tools   2.9.0-beta8-63208-01
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.2 for F# 4.5   15.8.0.0.  Commit Hash: 55a3dc3231c95c77f81ee53f7d29152029da7408.
Microsoft Visual F# Tools 10.2 for F# 4.5

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   4.11.0.779 (d15-8@ff915e800)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.15.12 (d7ff6f39c)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   1.1.118 (4217ee9)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   9.0.0.19 (HEAD/a8a3b0ec7)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   12.1.0.15 (cbfb047)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
@rihadavid
Copy link
Author

I have just found exact steps for this issue:

  1. Create the sample single view android project
  2. Open content_main.axml and change anything in the file - for example, change "Hello world!" to "Hello Xamarin!" in the TextView
  3. Save all files
  4. Build
  5. The build fails, without any error. Build again and it succeeds.

Note that if you skip the step 3 and let the files save automatically by building, the issue is not present and it builds successfully.

@rihadavid rihadavid changed the title Build sometimes fails without any error Build fails first time after layout file changed and saved Nov 14, 2018
@rihadavid
Copy link
Author

Anybody could look at this? :) Maybe @jonathanpeppers or @garuma ? And also the other issue #2425 I reported 10 days ago. These two issues are getting quite annoying 🤕 Thanks!

@rihadavid
Copy link
Author

rihadavid commented Nov 26, 2018

Now I am not sure whether we should report Xamarin bugs in Visual Studio reporting system where it takes forever to get a response to a reported issue or github where, well, it takes the same.
Maybe I should start awaiting an email that my issues were closed because of inactivity 😄
GitHub Logo

@jonathanpeppers
Copy link
Member

@rihadavid, sorry I have been out of the office for two weeks (work trip + Thanksgiving).

I tried your steps above with VS 15.9.1 and it worked for me. Have you tried updating to 15.9?

If you are still seeing the issue, can you post the error message you are getting? Are the logs always blank? (try this setting)

@jonathanpeppers jonathanpeppers self-assigned this Nov 26, 2018
@jonathanpeppers jonathanpeppers added bug Component does not function as intended. need-info Issues that need more information from the author. labels Nov 26, 2018
@rihadavid
Copy link
Author

Thanks for the reply!
It's still happening in 15.9.2 and I was using the diagnostic output from the start.
Now in 15.9.2, it gives this output:

1>Project 'App9' is not up to date. Input file 'C:\Users\David\source\repos\App9\App9\Resources\layout\content_main.axml' is modified after output file ''.
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
Running restore with 8 concurrent jobs.
Reading project file C:\Users\David\source\repos\App9\App9\App9.csproj.
The restore inputs for 'App9' have not changed. No further actions are required to complete the restore.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: C:\Users\David\source\repos\App9\App9\obj\project.assets.json
No-Op restore. The cache will not be updated. Path: C:\Users\David\source\repos\App9\App9\obj\App9.csproj.nuget.cache
Restore completed in 23.26 ms for C:\Users\David\source\repos\App9\App9\App9.csproj.

NuGet Config files used:
    C:\Users\David\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
    https://api.nuget.org/v3/index.json
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
1>------ Build started: Project: App9, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@jonathanpeppers
Copy link
Member

jonathanpeppers commented Nov 26, 2018

@rihadavid it looks like your logging is set to minimal.

The top of mine looks like:

image

You should also see an error message somewhere? In the error pad?

@rihadavid
Copy link
Author

It looks exactly like yours when it builds without the error (second time, or without saving the edited file).

Yes, I should see the error, but I don't, that's the thing

@jonathanpeppers
Copy link
Member

Can you save the file, then build command line?

# NOTE: Your MSBuild is probably at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
msbuild YourSolution.sln /bl

This will put a msbuild.binlog file in the current directory you can zip and upload here.

You might also get a better error message.

@rihadavid
Copy link
Author

When using the command line, the build always succeeds. Tried multiple times, with the exact steps - happening in VS, not happening in cmd.
Successful msbuild.binlog: msbuild.zip

@jonathanpeppers
Copy link
Member

@joj have you seen something like this?

@joj
Copy link
Contributor

joj commented Nov 26, 2018

@jonathanpeppers I haven't. My guess is that there's a file getting locked by msbuild still running on VS, which doesn't happen in command line. I may be completely wrong, though.

@joj
Copy link
Contributor

joj commented Nov 26, 2018

@rihadavid sorry for the time it took to answer on developer community. We're actively improving that now so timing should be much faster.

@jonathanpeppers
Copy link
Member

@joj any updates? @kzu mentioned that you guys were adding some locking to prevent two builds happening at once?

(I assume it must be rare, because I haven't seen this happen myself)

@joj
Copy link
Contributor

joj commented Feb 5, 2019

I need to find the DevCom item. I'm on something right now, but I will asap.

@kzu
Copy link
Contributor

kzu commented Feb 7, 2019

@jonathanpeppers at least on the XVS side of the house, we don't manually trigger any builds for .axml updates, so if something happens as a side effect of that via a %(Generator), then that's all just MSBuild. Not sure if @garuma is doing something on save there which could also trigger this behavior.

@SSELLIOTTHOME
Copy link

I have replicated this very same problem. It happens on large non trivial projects, and only after upgrading Visual Studio 2017 from quite an early one. Whilst it is not a show stopper, it is not great.

Steven

@grendello grendello added this to the d7-6 milestone Apr 2, 2019
@jonathanpeppers jonathanpeppers modified the milestones: d7-6, d16-2 May 3, 2019
@pjcollins pjcollins removed this from the d16-2 milestone Jun 20, 2019
@pjcollins
Copy link
Member

I don't think we've ever managed to come up with a consistent reproduction for this. I am going to close it, please feel free to reopen if there are any consistent steps that can be used to help narrow down what's going wrong here.

@rihadavid
Copy link
Author

@pjcollins for me, it's still happening every time in VS 2019 16.1.2 using the exact steps written in the second comment

@pjcollins
Copy link
Member

pjcollins commented Jun 20, 2019

Sorry for the abrupt resolution, I took another look at this with VS 2019 16.1 and I am seeing similar behavior.

Steps (as described above):

  1. Create a new Single View Android App.
  2. Wait for initial design time build to complete, and intellisense to show up.
  3. Open Resources -> layout -> content_main.axml.
  4. Change "Hello World" text to anything else.
  5. Press CTRL+S to save.
  6. Press F5.

I see a build failure reported in the build output, and sometimes the build partially continues, but ultimately it never completes - https://gist.github.com/pjcollins/0dca5a483a9d30873578a972a6001b49.

Binlogs:
xa2427.zip

Edit: after some more investigation, it appears that there might be some interference caused by Live Code Analysis:

image

Severity    Code    Description    Project    File    Line    Suppression State    Detail Description
Warning    AD0001    Analyzer 'Microsoft.CodeAnalysis.CSharp.Diagnostics.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastDiagnosticAnalyzer' threw an exception of type 'System.InvalidOperationException' with message 'Unexpected value 'UnsetConversionKind' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind''.    App14        1    Active    Analyzer 'Microsoft.CodeAnalysis.CSharp.Diagnostics.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastDiagnosticAnalyzer' threw the following exception:
'Exception occurred with following context:
Compilation: App14
SyntaxTree: source\repos\App14\App14\MainActivity.cs
SyntaxNode: (Android.Views.View.IOnClickListener ... [CastExpressionSyntax]@[1673..1714) (49,37)-(49,78)

System.InvalidOperationException: Unexpected value 'UnsetConversionKind' of type 'Microsoft.CodeAnalysis.CSharp.ConversionKind'
   at Microsoft.CodeAnalysis.CSharp.ConversionKindExtensions.IsImplicitConversion(ConversionKind conversionKind)
   at Microsoft.CodeAnalysis.CSharp.Extensions.CastExpressionSyntaxExtensions.IsUnnecessaryCast(CastExpressionSyntax cast, SemanticModel semanticModel, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CSharp.Diagnostics.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.IsUnnecessaryCast(SemanticModel model, CastExpressionSyntax cast, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.RemoveUnnecessaryCast.RemoveUnnecessaryCastDiagnosticAnalyzerBase`2.TryRemoveCastExpression(SemanticModel model, TCastExpression node, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.RemoveUnnecessaryCast.RemoveUnnecessaryCastDiagnosticAnalyzerBase`2.AnalyzeSyntax(SyntaxNodeAnalysisContext context)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.<>c__50`1.<ExecuteSyntaxNodeAction>b__50_0(ValueTuple`2 data)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerExecutor.ExecuteAndCatchIfThrows_NoLock[TArg](DiagnosticAnalyzer analyzer, Action`1 analyze, TArg argument, Nullable`1 info)
-----
'.

@pjcollins pjcollins reopened this Jun 20, 2019
@rob313663
Copy link

I'm only writing here to get updates on the issue. Reported the same thing through Help/Send Feedback/Report a Problem in VS yesterday. @pjcollins you can close the report I made if you like.

@rihadavid
Copy link
Author

rihadavid commented Aug 13, 2019

ATTENTION PLEASE
9 months later, still not fixed. And it got much worse:

The original steps, updated with the bold text:

  1. Create the sample single view android project
  2. Open content_main.axml and change anything in the file - for example, change "Hello world!" to "Hello Xamarin!" in the TextView
  3. Save all files
  4. Build
  5. The build fails, without any error. Build again and it succeeds. with tons of unrelated, misleading errors. Also your Android designer window goes black.
  6. Building again does not help now, you need to clean and rebuild.

I also have many other new frustrating errors with the latest 16.2.1, but I am not really sure if reporting them is worth the effort, considering it will take (hopefully) about a year to get a fix 🤔

@jonathanpeppers
Copy link
Member

@rihadavid the original issue here taht @pjcollins and I could reproduce was related to the Code Analyzer in Visual Studio that we don't have much control over....

Could you file a new issue for what you see with latest 16.2, it is a different issue, correct?

@rihadavid
Copy link
Author

@jonathanpeppers it's the exactly same issue, just the symptoms got worse

@jonathanpeppers
Copy link
Member

@rihadavid but if you actually have a build log, then it is a different issue?

You said it has misleading errors. Before we were getting empty build logs and no error information, such as:

1>------ Build started: Project: MyApp.Android, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

@rob313663
Copy link

rob313663 commented Aug 13, 2019 via email

@jonathanpeppers
Copy link
Member

These steps just worked for me: #2427 (comment)

Can someone share diagnostic build logs of what you're seeing?

https://docs.microsoft.com/en-us/xamarin/android/troubleshooting/troubleshooting#diagnostic-msbuild-output

@rihadavid
Copy link
Author

@jonathanpeppers turns out it's even more tricky:

  1. Create the sample single view android project
  2. Open content_main.axml and change anything in the file - for example, change "Hello world!" to "Hello Xamarin!" in the TextView
  3. Save all files
  4. Build
  5. The build fails, without any error. Build again and it succeeds.
  6. Build again and it sometimes fails, again without any error, and sometimes succeeds.
  7. OR, INSTEAD OF THE STEP 6, edit the axml file again and this time, do not save it but build it unsaved - then the build fails with tons of unrelated, misleading errors (see below). Also your Android designer window goes black. Now the only thing that helps is cleaning and rebuilding.
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.companyname.app15:style/Theme.AppCompat.Light.DarkActionBar) not found.
1>  C:\Users\David\source\repos\App15\App15\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/colorPrimary (aka com.companyname.app15:attr/colorPrimary)' not found.
1>  C:\Users\David\source\repos\App15\App15\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/colorPrimaryDark (aka com.companyname.app15:attr/colorPrimaryDark)' not found.
1>  C:\Users\David\source\repos\App15\App15\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/colorAccent (aka com.companyname.app15:attr/colorAccent)' not found.
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: resource style/ThemeOverlay.AppCompat.Dark.ActionBar (aka com.companyname.app15:style/ThemeOverlay.AppCompat.Dark.ActionBar) not found.
1>  C:\Users\David\source\repos\App15\App15\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/windowActionBar (aka com.companyname.app15:attr/windowActionBar)' not found.
1>  C:\Users\David\source\repos\App15\App15\Resources\values\styles.xml(2): error APT0000: style attribute 'attr/windowNoTitle (aka com.companyname.app15:attr/windowNoTitle)' not found.
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: resource style/ThemeOverlay.AppCompat.Light (aka com.companyname.app15:style/ThemeOverlay.AppCompat.Light) not found.
1>  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1697,2): error APT0000: failed linking references.

@jonathanpeppers
Copy link
Member

This is a completely different issue than what we were seeing with the code analyzer.

I am not sure what is different with my PC, but I can't get it to fail like this. Can you include the full log?

@jonathanpeppers
Copy link
Member

Does the problem go away if you uncheck this setting?

image

@rihadavid
Copy link
Author

And the diagnostic logs:
First build:

1>Project 'App15' is not up to date. Missing output file 'C:\Users\David\source\repos\App15\App15\bin\Debug\App15.dll'.
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
Running restore with 8 concurrent jobs.
Reading project file C:\Users\David\source\repos\App15\App15\App15.csproj.
Persisting no-op dg to C:\Users\David\source\repos\App15\App15\obj\App15.csproj.nuget.dgspec.json
Restoring packages for C:\Users\David\source\repos\App15\App15\App15.csproj...
Restoring packages for MonoAndroid,Version=v9.0...
Resolving conflicts for MonoAndroid,Version=v9.0...
Checking compatibility of packages on MonoAndroid,Version=v9.0.
Checking compatibility for App15 1.0.0 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Design 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Core.Utils 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.CustomTabs 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Essentials 1.1.0 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.v7.AppCompat 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.v7.CardView 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.v7.RecyclerView 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Annotations 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Compat 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Core.UI 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Fragment 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Transition 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.DocumentFile 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Loader 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.LocalBroadcastManager 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Print 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Collections 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Interpolator 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for System.Numerics.Vectors 4.5.0 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Animated.Vector.Drawable 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.CursorAdapter 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.Vector.Drawable 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Lifecycle.Runtime 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.VersionedParcelable 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.AsyncLayoutInflater 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.CoordinaterLayout 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.CustomView 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.DrawerLayout 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.SlidingPaneLayout 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.SwipeRefreshLayout 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Support.ViewPager 28.0.0.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Lifecycle.ViewModel 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Lifecycle.LiveData 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Core.Common 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Lifecycle.Common 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Core.Runtime 1.1.1.1 with MonoAndroid,Version=v9.0.
Checking compatibility for Xamarin.Android.Arch.Lifecycle.LiveData.Core 1.1.1.1 with MonoAndroid,Version=v9.0.
All packages and projects are compatible with MonoAndroid,Version=v9.0.
Committing restore...
Assets file has not changed. Skipping assets file writing. Path: C:\Users\David\source\repos\App15\App15\obj\project.assets.json
Writing cache file to disk. Path: C:\Users\David\source\repos\App15\App15\obj\App15.csproj.nuget.cache
Restore completed in 142.71 ms for C:\Users\David\source\repos\App15\App15\App15.csproj.

NuGet Config files used:
    C:\Users\David\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
    C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config

Feeds used:
    https://api.nuget.org/v3/index.json
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
NuGet package restore finished.
1>------ Build started: Project: App15, Configuration: Debug Any CPU ------
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Now from step #5 going to step #7 (but turns out this doesn't happen always, sometime it succeeds), diagnostic log here:
log.txt
.

@rihadavid
Copy link
Author

Does the problem go away if you uncheck this setting?

image

No

@jonathanpeppers
Copy link
Member

So a theory... I think I reproduced it when I rename C:\Program Files (x86)\Android\android-sdk\ndk-bundle to something else where Xamarin.Android can't find it.

If you install the Android NDK, does that help?

image

@rihadavid
Copy link
Author

Ok, so it seems that those are actually two issues, not one. I created a report for the other one: #3494
Unfortunatelly, installing NDK (and restarting VS) did not help with any of them.

@rihadavid
Copy link
Author

So, to make it clear, for this issue we can stick with the steps in the second comment, it's still happening the same, except that building again (in the last step) now doesn't always work.

@rihadavid
Copy link
Author

@jonathanpeppers still happening in VS 16.3.0 .. the only way out of this is to try build (or clean) again and again and again and again.. about 10th attempt usually works.

@jonathanpeppers
Copy link
Member

@rihadavid so is this still the issue with the code analyzer or #3494? I just retested what I thought we fixed for #3494 and it seems to be fixed for me with 16.3.2. It was these steps: #3494 (comment)

We have a similar problem we are tracking here, but we don't have clear steps to repro this: #3702

@rihadavid
Copy link
Author

#3494 seems to be fixed, but this one, using the steps in the second comment is still happening. Without any logs, just failing.

I think it will not be related to #3702, as that one is having error logs, this one does not.

@jonathanpeppers
Copy link
Member

Since, I can't repro it, do you have the same options as me here?

image

Could I have unchecked the Enable full solution analysis box, and that fixed it?

@rihadavid
Copy link
Author

I tried the same setting and the bug is still present

@rihadavid
Copy link
Author

@jonathanpeppers still not fixed

@jonathanpeppers
Copy link
Member

@rihadavid I haven't seen this issue myself in a long time.

What version of Visual Studio and Xamarin.Android are you using right now? Are you using any other extensions like ReSharper, etc.?

@rihadavid
Copy link
Author

VS 16.4.5, Xamarin.Android 10.1.4.0, no extensions

@jonathanpeppers
Copy link
Member

@rihadavid can you try the 16.5 preview?

There was an issue where the Android designer was running MSBuild targets in parallel, which can cause random build errors. That fix is only in 16.5 and higher.

It is not an issue in this repo, but if you can confirm if it is fixed or not we can close this, thanks!

@rihadavid
Copy link
Author

Congrats, it's fixed in 16.5 stable release! It only took 16 months 🤣 Thanks anyway! 👍

@jonathanpeppers
Copy link
Member

It only took 16 months

I would compare us to the last time you sent a bug to Android Studio and it actually got fixed. 16 months is less than infinity. 👀 😄

@ghost ghost locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Component does not function as intended.
Projects
None yet
Development

No branches or pull requests

10 participants