Closed rihadavid closed 4 years ago
I have just found exact steps for this issue:
content_main.axml
and change anything in the file - for example, change "Hello world!" to "Hello Xamarin!" in the TextViewNote that if you skip the step 3 and let the files save automatically by building, the issue is not present and it builds successfully.
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!
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 😄
@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)
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 ==========
@rihadavid it looks like your logging is set to minimal.
The top of mine looks like:
You should also see an error message somewhere? In the error pad?
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
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.
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
@joj have you seen something like this?
@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.
@rihadavid sorry for the time it took to answer on developer community. We're actively improving that now so timing should be much faster.
@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)
I need to find the DevCom item. I'm on something right now, but I will asap.
@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.
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
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.
@pjcollins for me, it's still happening every time in VS 2019 16.1.2 using the exact steps written in the second comment
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):
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:
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)
-----
'.
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.
Glad I'm not the only seeing this. Happens for me on VS 2019 Pro 16.2.0. It's quite frustrating to work with but the hint that it happens when saving manually should help a bit I guess.
Hoping this issue will get resolved.
ATTENTION PLEASE 9 months later, still not fixed. And it got much worse:
The original steps, updated with the bold text:
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 🤔
@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?
@jonathanpeppers it's the exactly same issue, just the symptoms got worse
@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 ==========
It is so easy to reproduce. Why the discussion? If you are not able to reproduce, please say so, I am happy to let you remote control my pc and investigate if you like.
On Tue, Aug 13, 2019, 19:28 Jonathan Peppers notifications@github.com wrote:
@rihadavid https://github.com/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 ==========
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xamarin/xamarin-android/issues/2427?email_source=notifications&email_token=AFQNI4OCEEVSNJHBOASDRALQELVM5A5CNFSM4GDCT7YKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4GMC7A#issuecomment-520929660, or mute the thread https://github.com/notifications/unsubscribe-auth/AFQNI4KANCLI27NXEFEKHQ3QELVM5ANCNFSM4GDCT7YA .
These steps just worked for me: https://github.com/xamarin/xamarin-android/issues/2427#issuecomment-520927108
Can someone share diagnostic build logs of what you're seeing?
@jonathanpeppers turns out it's even more tricky:
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.
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?
Does the problem go away if you uncheck this setting?
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 .
Does the problem go away if you uncheck this setting?
No
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?
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.
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.
@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.
@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: https://github.com/xamarin/xamarin-android/issues/3494#issuecomment-520968557
We have a similar problem we are tracking here, but we don't have clear steps to repro this: https://github.com/xamarin/xamarin-android/issues/3702
I think it will not be related to #3702, as that one is having error logs, this one does not.
Since, I can't repro it, do you have the same options as me here?
Could I have unchecked the Enable full solution analysis
box, and that fixed it?
I tried the same setting and the bug is still present
@jonathanpeppers still not fixed
@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.?
VS 16.4.5, Xamarin.Android 10.1.4.0, no extensions
@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!
Congrats, it's fixed in 16.5 stable release! It only took 16 months 🤣 Thanks anyway! 👍
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. 👀 😄
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:
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