Xamarin-macios: [Bug] XF for Mac, have to clean before each build to see changes

Created on 2 Jul 2020  路  11Comments  路  Source: xamarin/xamarin-macios

Description

Code changes aren't reflected when running the Mac app unless the current project is cleaned first

Instructions for creating an XF for Mac app: https://devblogs.microsoft.com/xamarin/preview-bringing-macos-to-xamarin-forms/

Forum conversation where Xamarin asked me to raise this issue here: https://forums.xamarin.com/discussion/183016/anyone-here-having-to-clean-before-every-build-for-mac-apps#latest

Steps to Reproduce

  1. Unzip the attached example and open the solution, restore packages etc
  2. Set XF4Mac as startup project
  3. Run it, see that the text is black
  4. Change the label text colour to Red in MainPage.cs
  5. Run it

Expected Behavior

Label text should be red

Actual Behavior

Label text is still black

Basic Information

  • Version with issue: 4.5 +,
  • Last known good version: None
  • IDE:
  • Platform Target Frameworks:

    • iOS:

    • Android:

    • UWP:

  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

Workaround


Clean the project before each build. Tedious, but it works

XF4iOSAndroidMacDemo.zip

bug macOS

All 11 comments

I have the same issue, but I think it is an issue of Visual Studio for Mac, because it works in Visual Studio for Windows.

@chamons can you help us figure out this one?

I was able to verify this. works fine on iOS, doesn't work on MacOS

the net standard lib containing the app is correctly rebuilt, but the actual app is not

drwxr-xr-x  3 sde  staff       96 Jul  6 15:01 XF4Mac.app
-rw-r--r--  1 sde  staff     5632 Jul  6 15:01 XF4Mac.exe
-rw-r--r--  1 sde  staff     1352 Jul  6 15:01 XF4Mac.pdb
-rw-r--r--@ 1 sde  staff     6144 Jul  6 15:03 XF4iOSAndroidMacDemo.dll
-rw-r--r--@ 1 sde  staff     1116 Jul  6 15:03 XF4iOSAndroidMacDemo.pdb

and the version packaged in bin/Debug/XF4Mac.app/Contents/MonoBundle/ is not updated

I can reproduce this, but I am unsure if it a Xamarin.Forms bug or a Xamarin.Mac bug as of yet.

Hmm, so the reason we're not seeing the change is that we are copying in the change to the bin/debug dir:

 Copying file from "/Users/donblas/Downloads/XF4iOSAndroidMacDemo/XF4iOSAndroidMacDemo/bin/Debug/netstandard2.0/XF4iOSAndroidMacDemo.dll" to "/Users/donblas/Downloads/XF4iOSAndroidMacDemo/XF4Mac/bin/Debug/XF4iOSAndroidMacDemo.dll".
 ```

but not re-running mmp to add to the package:

Skipping target "_CompileToNative" because all output files are up-to-date with respect to the input files.
Input files: /Users/donblas/Downloads/XF4iOSAndroidMacDemo/XF4Mac/bin/Debug/XF4Mac.exe
Output files: bin/Debug/XF4Mac.app/Contents/MacOS/XF4Mac
```

My guess would be that that file isn't listed in the Inputs, or that the Outputs' timestamp hasn't changed here:

https://github.com/xamarin/xamarin-macios/blob/edd8a2c8963063ca0ab3357e251944f4aa053fa8/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets#L390-L391

@rolfbjarne it seems to be exactly that. It appears that after an edit, only the final .exe reaches that target. Let me see where it drops off.

image

Not sure where @(BundleDependentFiles) comes from... It does not appear in any targets or props files...

I think I have a fix for this:

image

Was this page helpful?
0 / 5 - 0 ratings