xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.64k stars 1.88k forks source link

[Bug] Debugging Android application throws BadImageFormatException in VS 17.6 #15768

Closed danielkraut closed 1 year ago

danielkraut commented 1 year ago

Description

After updating Visual Studio Community to 17.6, I can no longer debug Xamarin.Forms application (I tried Android only as I don't have iOS device at the moment).

Steps to Reproduce

  1. Update Visual Studio
  2. Set a breakpoint in any ViewModel
  3. Launch

Basic Information

Environment

Show/Hide Visual Studio info ``` Microsoft Visual Studio Community 2022 Version 17.6.3 VisualStudio.17.Release/17.6.3+33801.468 Microsoft .NET Framework Version 4.8.04084 Installed Version: Community Visual C++ 2022 00476-80000-00000-AA773 Microsoft Visual C++ 2022 ASP.NET and Web Tools 17.6.326.62524 ASP.NET and Web Tools Azure App Service Tools v3.0.0 17.6.326.62524 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 17.6.326.62524 Azure Functions and Web Jobs Tools C# Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a 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.4.21 (main@8f226a8) 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 Mono Debugging for Visual Studio 17.6.41 (790a401) Support for debugging Mono processes with Visual Studio. NuGet Package Manager 6.6.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Razor (ASP.NET Core) 17.6.0.2327201+a6a61fdfa748eaa65aab53dab583276e26af4a3e Provides languages services for ASP.NET Core Razor. SQL Server Data Tools 17.6.13.0 Microsoft SQL Server Data Tools StylerPackage Extension 1.0 StylerPackage Visual Stuido Extension Detailed Info Syntax Visualizer 1.0 An extension for visualizing Roslyn SyntaxTrees. Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory. Test Adapter for Google Test 1.0 Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory. TypeScript Tools 17.0.20329.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a 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 17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97 Microsoft Visual F# Tools Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info Xamarin 17.6.0.251 (d17-6@318364c) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.6.6.0 (remotes/origin/d17-6@cb430751d1) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.6.32 (98c12a2) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 13.2.0.6 (d17-5/a200af1) Xamarin.Android Reference Assemblies and MSBuild support. Mono: 6dd9def Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@9f02d77 Xamarin.iOS and Xamarin.Mac SDK 16.4.0.6 (97731c92c) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```

Build log

Show/Hide Build log ``` 1>Starting deployment to Google Pixel 6 Pro ... 1>Deploying to Google Pixel 6 Pro ... Build started. Project "Iskl.Android.csproj" (Install target(s)): Found Java SDK version 11.0.16.1. Found Java SDK version 11.0.16.1. Dex Fast Deployment Enabled: False MonoAndroid Tools: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\ Android Platform API level: 30 TargetFrameworkVersion: v11.0 Android NDK: C:\Program Files (x86)\Android\android-sdk dk-bundle\ Android SDK: C:\Program Files (x86)\Android\android-sdk\ Android SDK Build Tools: C:\Program Files (x86)\Android\android-sdk\build-tools\32.0.0\ Java SDK: C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\ Application Java class: android.app.Application Project "Iskl.Core.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Core.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Shared.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.Shared.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.UI.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.UI.csproj". Project "Iskl.UI.csproj" (GetTargetFrameworks target(s)): Done building project "Iskl.UI.csproj". Project "Iskl.Core.csproj" (GetTargetPath target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Core.csproj" (GetTargetPath target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Shared.csproj" (GetTargetPath target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.Shared.csproj" (GetTargetPath target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.UI.csproj" (GetTargetPath target(s)): Done building project "Iskl.UI.csproj". Project "Iskl.UI.csproj" (GetTargetPath target(s)): Done building project "Iskl.UI.csproj". Project "Iskl.Core.csproj" (GetNativeManifest target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Core.csproj" (GetNativeManifest target(s)): Done building project "Iskl.Core.csproj". Project "Iskl.Shared.csproj" (GetNativeManifest target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.Shared.csproj" (GetNativeManifest target(s)): Done building project "Iskl.Shared.csproj". Project "Iskl.UI.csproj" (GetNativeManifest target(s)): Done building project "Iskl.UI.csproj". Project "Iskl.UI.csproj" (GetNativeManifest target(s)): Done building project "Iskl.UI.csproj". The preprocessor token 'rootnamespace' has been given more than one value. Choosing 'Iskl.Droid' as the value. The preprocessor token 'assemblyname' has been given more than one value. Choosing 'Iskl.Android' as the value. The preprocessor token 'fullpath' has been given more than one value. Choosing 'C:\Users\kraut\AWebSys\ISKL\xamarin\Iskl.Android' as the value. The preprocessor token 'outputfilename' has been given more than one value. Choosing 'Iskl.Android.dll' as the value. The preprocessor token 'filename' has been given more than one value. Choosing 'Iskl.Android.csproj' as the value. Found conflicts between different versions of "System.Numerics.Vectors" that could not be resolved. There was a conflict between "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" was not. References which depend on "System.Numerics.Vectors, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" [C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll]. C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll Project file item includes which caused reference "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Numerics.Vectors.dll". System.Numerics.Vectors References which depend on "System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" []. C:\Users\kraut\.nuget\packages\system.text.json\7.0.2\lib etstandard2.0\System.Text.Json.dll Project file item includes which caused reference "C:\Users\kraut\.nuget\packages\system.text.json\7.0.2\lib etstandard2.0\System.Text.Json.dll". C:\Users\kraut\.nuget\packages\system.text.json\7.0.2\lib etstandard2.0\System.Text.Json.dll C:\Users\kraut\AWebSys\ISKL\xamarin\Iskl.Core\bin\Debug etstandard2.1\Iskl.Core.dll C:\Users\kraut\AWebSys\ISKL\xamarin\Iskl.Shared\bin\Debug etstandard2.1\Iskl.Shared.dll C:\Users\kraut\.nuget\packages\microsoft.extensions.dependencymodel\5.0.0\lib etstandard2.0\Microsoft.Extensions.DependencyModel.dll C:\Users\kraut\.nuget\packages\microsoft.entityframeworkcore.sqlite.core\5.0.15\lib etstandard2.1\Microsoft.EntityFrameworkCore.Sqlite.dll C:\Users\kraut\.nuget\packages\restsharp\109.0.1\lib etstandard2.0\RestSharp.dll C:\Users\kraut\.nuget\packages\system.net.http.json\7.0.1\lib etstandard2.0\System.Net.Http.Json.dll C:\Users\kraut\AWebSys\ISKL\xamarin\Iskl.UI\bin\Debug etstandard2.1\Iskl.UI.dll Skipping target "_ResolveLibraryProjectImports" because all output files are up-to-date with respect to the input files. Skipping target "_BuildLibraryImportsCache" because all output files are up-to-date with respect to the input files. Skipping target "_GenerateAndroidResourceDir" because all output files are up-to-date with respect to the input files. Skipping target "_GenerateLayoutBindings" because it has no outputs. Skipping target "_ConvertResourcesCases" because all output files are up-to-date with respect to the input files. Skipping target "_CompileResources" because all output files are up-to-date with respect to the input files. Skipping target "_PrepareUpdateAndroidResgen" because all output files are up-to-date with respect to the input files. Skipping target "_UpdateAndroidResgen" because all output files are up-to-date with respect to the input files. Adding assembly reference for Iskl.Android, recursively... Adding assembly reference for netstandard, recursively... Adding assembly reference for System.Data, recursively... Adding assembly reference for System.Transactions, recursively... Adding assembly reference for System.Data.DataSetExtensions, recursively... Adding assembly reference for System.IO.Compression, recursively... Adding assembly reference for System.IO.Compression.FileSystem, recursively... Adding assembly reference for System.ComponentModel.Composition, recursively... Adding assembly reference for System.Web.Services, recursively... Adding assembly reference for Iskl.Models, recursively... Adding assembly reference for System.ComponentModel.Annotations, recursively... Adding assembly reference for System.ComponentModel.DataAnnotations, recursively... Adding assembly reference for Awebsys.Http, recursively... Adding assembly reference for Iskl.Data, recursively... Adding assembly reference for System.Drawing.Common, recursively... Adding assembly reference for System.Runtime.InteropServices.WindowsRuntime, recursively... Adding assembly reference for System.Runtime.Serialization, recursively... Adding assembly reference for System.ServiceModel.Internals, recursively... Adding assembly reference for Akavache.Core, recursively... Adding assembly reference for Akavache, recursively... Adding assembly reference for Akavache.Sqlite3, recursively... Adding assembly reference for BCrypt.Net-Next, recursively... Adding assembly reference for FormsViewGroup, recursively... Adding assembly reference for Iskl.Core, recursively... Adding assembly reference for Iskl.Shared, recursively... Adding assembly reference for Iskl.UI, recursively... Adding assembly reference for Java.Interop, recursively... Adding assembly reference for Microsoft.AppCenter.Analytics.Android.Bindings, recursively... Adding assembly reference for Microsoft.AppCenter.Analytics, recursively... Adding assembly reference for Microsoft.AppCenter.Android.Bindings, recursively... Adding assembly reference for Microsoft.AppCenter.Crashes.Android.Bindings, recursively... Adding assembly reference for Microsoft.AppCenter.Crashes, recursively... Adding assembly reference for Microsoft.AppCenter.Distribute.Android.Bindings, recursively... Adding assembly reference for Microsoft.AppCenter.Distribute, recursively... Adding assembly reference for Microsoft.AppCenter, recursively... Adding assembly reference for Microsoft.Bcl.AsyncInterfaces, recursively... Adding assembly reference for Microsoft.Data.Sqlite, recursively... Adding assembly reference for Microsoft.DotNet.PlatformAbstractions, recursively... Adding assembly reference for Microsoft.EntityFrameworkCore.Abstractions, recursively... Adding assembly reference for Microsoft.EntityFrameworkCore, recursively... Adding assembly reference for Microsoft.EntityFrameworkCore.Relational, recursively... Adding assembly reference for Microsoft.EntityFrameworkCore.Sqlite, recursively... Adding assembly reference for Microsoft.Extensions.Caching.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.Caching.Memory, recursively... Adding assembly reference for Microsoft.Extensions.Configuration.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.DependencyInjection.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.DependencyInjection, recursively... Adding assembly reference for Microsoft.Extensions.DependencyModel, recursively... Adding assembly reference for Microsoft.Extensions.FileProviders.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.Hosting.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.Http, recursively... Adding assembly reference for Microsoft.Extensions.Localization.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.Logging.Abstractions, recursively... Adding assembly reference for Microsoft.Extensions.Logging, recursively... Adding assembly reference for Microsoft.Extensions.Options, recursively... Adding assembly reference for Microsoft.Extensions.Primitives, recursively... Adding assembly reference for Mono.Android, recursively... Adding assembly reference for mscorlib, recursively... Adding assembly reference for Newtonsoft.Json.Bson, recursively... Adding assembly reference for Newtonsoft.Json, recursively... Adding assembly reference for NLog, recursively... Adding assembly reference for NLog.Extensions.Logging, recursively... Adding assembly reference for Quartz, recursively... Adding assembly reference for Quartz.Extensions.DependencyInjection, recursively... Adding assembly reference for RestSharp, recursively... Adding assembly reference for System.Threading.Tasks.Extensions, recursively... Adding assembly reference for Sharpnado.CollectionView, recursively... Adding assembly reference for Sharpnado.CollectionView.Droid, recursively... Adding assembly reference for Sharpnado.Shadows.Android, recursively... Adding assembly reference for Sharpnado.Shadows, recursively... Adding assembly reference for Sharpnado.Tabs.Android, recursively... Adding assembly reference for Sharpnado.Tabs, recursively... Adding assembly reference for Sharpnado.TaskMonitor, recursively... Adding assembly reference for SimpleInjector, recursively... Adding assembly reference for SimpleInjector.Integration.ServiceCollection, recursively... Adding assembly reference for SkiaSharp, recursively... Adding assembly reference for SkiaSharp.Extended, recursively... Adding assembly reference for SkiaSharp.Extended.Svg, recursively... Adding assembly reference for SkiaSharp.Views.Android, recursively... Adding assembly reference for SkiaSharp.Views.Forms, recursively... Adding assembly reference for Splat, recursively... Adding assembly reference for SQLitePCLRaw.batteries_v2, recursively... Adding assembly reference for SQLitePCLRaw.core, recursively... Adding assembly reference for SQLitePCLRaw.lib.e_sqlite3.android, recursively... Adding assembly reference for SQLitePCLRaw.provider.e_sqlite3, recursively... Adding assembly reference for System.Buffers, recursively... Adding assembly reference for System.Collections.Immutable, recursively... Adding assembly reference for System.Configuration.ConfigurationManager, recursively... Adding assembly reference for System.Security.Cryptography.ProtectedData, recursively... Adding assembly reference for System.Security, recursively... Adding assembly reference for System.Core, recursively... Adding assembly reference for System.Diagnostics.DiagnosticSource, recursively... Adding assembly reference for System, recursively... Adding assembly reference for Mono.Security, recursively... Adding assembly reference for System.Memory, recursively... Adding assembly reference for System.Net.Http, recursively... Adding assembly reference for System.Net.Http.Json, recursively... Adding assembly reference for System.Numerics, recursively... Adding assembly reference for System.Numerics.Vectors, recursively... Adding assembly reference for System.Reactive, recursively... Adding assembly reference for System.Runtime.CompilerServices.Unsafe, recursively... Adding assembly reference for System.Runtime, recursively... Adding assembly reference for System.Security.AccessControl, recursively... Adding assembly reference for System.Security.Permissions, recursively... Adding assembly reference for System.Security.Principal.Windows, recursively... Adding assembly reference for System.Text.Encodings.Web, recursively... Adding assembly reference for System.Text.Json, recursively... Adding assembly reference for System.Xml, recursively... Adding assembly reference for System.Xml.Linq, recursively... Adding assembly reference for WeakEvent, recursively... Adding assembly reference for Xamarin.AndroidX.Activity, recursively... Adding assembly reference for Xamarin.AndroidX.Annotation, recursively... Adding assembly reference for Xamarin.AndroidX.Annotation.Experimental, recursively... Adding assembly reference for Xamarin.AndroidX.AppCompat.AppCompatResources, recursively... Adding assembly reference for Xamarin.AndroidX.AppCompat, recursively... Adding assembly reference for Xamarin.AndroidX.Arch.Core.Common, recursively... Adding assembly reference for Xamarin.AndroidX.Arch.Core.Runtime, recursively... Adding assembly reference for Xamarin.AndroidX.AsyncLayoutInflater, recursively... Adding assembly reference for Xamarin.AndroidX.Browser, recursively... Adding assembly reference for Xamarin.AndroidX.CardView, recursively... Adding assembly reference for Xamarin.AndroidX.Collection, recursively... Adding assembly reference for Xamarin.AndroidX.Concurrent.Futures, recursively... Adding assembly reference for Xamarin.AndroidX.ConstraintLayout.Core, recursively... Adding assembly reference for Xamarin.AndroidX.ConstraintLayout, recursively... Adding assembly reference for Xamarin.AndroidX.CoordinatorLayout, recursively... Adding assembly reference for Xamarin.AndroidX.Core, recursively... Adding assembly reference for Xamarin.AndroidX.CursorAdapter, recursively... Adding assembly reference for Xamarin.AndroidX.CustomView, recursively... Adding assembly reference for Xamarin.AndroidX.DocumentFile, recursively... Adding assembly reference for Xamarin.AndroidX.DrawerLayout, recursively... Adding assembly reference for Xamarin.AndroidX.DynamicAnimation, recursively... Adding assembly reference for Xamarin.AndroidX.Fragment, recursively... Adding assembly reference for Xamarin.AndroidX.Interpolator, recursively... Adding assembly reference for Xamarin.AndroidX.Legacy.Support.Core.UI, recursively... Adding assembly reference for Xamarin.AndroidX.Legacy.Support.Core.Utils, recursively... Adding assembly reference for Xamarin.AndroidX.Legacy.Support.V4, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.Common, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.LiveData.Core, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.LiveData, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.Runtime, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.ViewModel, recursively... Adding assembly reference for Xamarin.AndroidX.Lifecycle.ViewModelSavedState, recursively... Adding assembly reference for Xamarin.AndroidX.Loader, recursively... Adding assembly reference for Xamarin.AndroidX.LocalBroadcastManager, recursively... Adding assembly reference for Xamarin.AndroidX.Media, recursively... Adding assembly reference for Xamarin.AndroidX.MultiDex, recursively... Adding assembly reference for Xamarin.AndroidX.Navigation.Common, recursively... Adding assembly reference for Xamarin.AndroidX.Navigation.Runtime, recursively... Adding assembly reference for Xamarin.AndroidX.Navigation.UI, recursively... Adding assembly reference for Xamarin.AndroidX.Preference, recursively... Adding assembly reference for Xamarin.AndroidX.Print, recursively... Adding assembly reference for Xamarin.AndroidX.RecyclerView, recursively... Adding assembly reference for Xamarin.AndroidX.SavedState, recursively... Adding assembly reference for Xamarin.AndroidX.SlidingPaneLayout, recursively... Adding assembly reference for Xamarin.AndroidX.SwipeRefreshLayout, recursively... Adding assembly reference for Xamarin.AndroidX.Tracing.Tracing, recursively... Adding assembly reference for Xamarin.AndroidX.Transition, recursively... Adding assembly reference for Xamarin.AndroidX.VectorDrawable.Animated, recursively... Adding assembly reference for Xamarin.AndroidX.VectorDrawable, recursively... Adding assembly reference for Xamarin.AndroidX.VersionedParcelable, recursively... Adding assembly reference for Xamarin.AndroidX.ViewPager, recursively... Adding assembly reference for Xamarin.AndroidX.ViewPager2, recursively... Adding assembly reference for Xamarin.CommunityToolkit, recursively... Adding assembly reference for Xamarin.Essentials, recursively... Adding assembly reference for Xamarin.Forms.Core, recursively... Adding assembly reference for Xamarin.Forms.Platform.Android, recursively... Adding assembly reference for Xamarin.Forms.Platform, recursively... Adding assembly reference for Xamarin.Forms.Xaml, recursively... Adding assembly reference for Xamarin.Google.Android.Material, recursively... Adding assembly reference for Xamarin.Google.Guava.ListenableFuture, recursively... Adding assembly reference for XamExtensionsSvg, recursively... Skipping target "_CopyConfigFiles" because it has no inputs. Skipping target "_ConvertPdbFiles" because it has no outputs. Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files. Skipping target "_CopyConfigFiles" because it has no inputs. Skipping target "_ConvertPdbFiles" because it has no outputs. Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files. Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files. Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files. Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files. Skipping target "_GenerateEmptyAndroidRemapNativeCode" because all output files are up-to-date with respect to the input files. Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files. Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files. Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files. Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files. Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files. Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files. Skipping target "_CompileToDalvik" because all output files are up-to-date with respect to the input files. Skipping target "_BuildApkFastDev" because all output files are up-to-date with respect to the input files. Touching "obj\Debug\110\android_debug_keystore.flag". Skipping target "_Sign" because all output files are up-to-date with respect to the input files. Skipping target "_Upload" because all output files are up-to-date with respect to the input files. Done building project "Iskl.Android.csproj". Build succeeded. 1>Deployment was successful to Google Pixel 6 Pro. ========== Deploy: 1 succeeded, 0 failed, 0 skipped ========== ========== Deploy started at 10:23 AM and took 02,068 seconds ========== ```

Screenshots

obrazek

Workaround

This issue suggests deleting bin and obj folders but it did not work for me - https://github.com/xamarin/xamarin-android/issues/8075

sfysi commented 1 year ago

I get the exact same error when calling a JavaScript Interface, building for SDK level 31.

Jones-Abramoff commented 1 year ago

Yesterday I started to get this error. I tried deleting bin, obj, all solution, restarting the computer, downgrading vs 2022 from 17.6.3 to 17.6.2, nothing worked. I may debug a smaller project but not the main one.

zLordZachy commented 1 year ago

I have the same problem. Yesterday I updated my VS and I got same problem. Also I tried delete bin, obj. But it did not worked.

image

zLordZachy commented 1 year ago

workaround: which worked for me Delete all breakpoints Delete all bin, and obj folders now it works

danielkraut commented 1 year ago

workaround: which worked for me Delete all breakpoints Delete all bin, and obj folders now it works

After that when you add new breakpoints does the issue appear again?

zLordZachy commented 1 year ago

workaround: which worked for me Delete all breakpoints Delete all bin, and obj folders now it works

After that when you add new breakpoints does the issue appear again?

No, I'm using it right now

Lucas-DeLorenzi commented 1 year ago

Hello, I have exactly the same problem but in my case, although I tried to fix it by deleting all bin and obj folders, cleaning and rebuilding the solution, the same thing happens...

image

Jones-Abramoff commented 1 year ago

I renamed the top level folder of the git project in my computer, cloned again from the repository and it started to work. It's not reliable. I have tried many things, including 17.7 preview 2. It clearly shows that depending on Xamarin is not an option anymore. And MAUI is also not reliable.

martin-dzik commented 1 year ago

I am experiencing the same issue. Deleting bin and obj folders worked maybe for a day and the same issue appeared then. Downgrading Visual Studio to any 17.6.x version didn't help. Downgrading Xamarin.Forms didn't help (tested latest 5.0.0.2578 and 5.0.0.2545).

mjsb212 commented 1 year ago

Same exact issue after Upgrading VS to 17.6.3 -- Cant Debug Android - breakpoints are not hit in a shared library that were previously working & I get System.BadImageFormatException error OR I get the warning message with no error: "No Compatible Code Running On The Thread...The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing). You can switch to another thread to see if there is compatible code running" -- this warning message is displayed only on SOME BREAKPOINTS in the same exact class in similar functions which is so strange, and if I continue stepping in then the System.BadImageFormatException error is eventually thrown. The breakpoint name gets highlighted in BOLD font as they should in the breakpoint window when they are hit right before the error happens. Before upgrading VS to 17.6.x Debugging was fine on same project with same source code and same breakpoints.

mjsb212 commented 1 year ago

After alot of troubleshooting I noticed this issue was only happening on projects I had recently built/ compiled after updating VS, and Issue was NOT happening on older projects I ran without any new build -- so when I got the error in a newly built project I restored a backup of my entire solution / project folder I had made BEFORE upgrading VS and suddenly debug is working again & everything is fine. Next I deleted those restored bin and obj folders and rebuilt / re-compiled everything to generate new bin/obj and ERROR HAPPENS AGAIN! So Issue seems like it has something to do with building after upgrading VS if that makes sense. This might be why others have intermittent success deleting bin/obj, but regardless, I still cant build anything new and run debugger. Has anyone found a proper WORKAROUND??? does fresh reinstall of VS work? This issue is also happening in MAUI projects - Upgrading VS to 17.6.3 completely broke all my debugging.

jfversluis commented 1 year ago

Unfortunately (in terms of a fix at least) this has nothing to do with Xamarin.Forms specifically I would think. From the information we have now it looks like this is in the tooling side of things. Please go into Visual Studio and click the Help menu > Provide Feedback and Report a Problem. That way the proper diagnostics will be collected and it will be routed to the correct team to help you further.

Thanks!

nzcoward commented 1 year ago

I realised this is closed, but I am curious if @danielkraut was using Sqlite and EFCore.

I was having an issue with this when I was running migrations in the DbContext. When I moved that out into my bootstrapper, it resolved the debugger problem.

danielkraut commented 1 year ago

@nzcoward No I was not using EFCore, although I was using Sqlite indirectly because I was using Akavache library which uses Sqlite internally.

jasells commented 1 year ago

Am getting this on Android only, only when built on Windows. Building the same app on Mac has no issues.

Microsoft Visual Studio Professional 2022 (64-bit) - Preview Version 17.7.0 Preview 2.0

martin-dzik commented 1 year ago

Here is the ticket on Visual Studio developer community. Feel free to upvote or attach your related issue/system logs. https://developercommunity.visualstudio.com/t/Debugging-XamarinForms-Android-app-throw/10392893