dotnet / dotnet/macios

"Clean" target does not delete all files in bin/obj folders

Open
#21,971 1 comment 2 reactions 0 assignees View on GitHub
msbuild
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

### Apple platform

iOS

### Framework version

net8.0-*

### Affected platform version

.NET 8.0.404, iOS workload 18.0.8319/8.0.100, JetBrains Rider 2024.3.3

### Description

After upgrading to the latest .NET SDK, iOS workload and Xcode, our iOS app would build but crash on startup with an odd error:
```
System.DllNotFoundException: __Internal
```
I tried rebuilding the project but go the same behaviour.
I then switched to our Android app (within the same solution) just to test my code changes.

Today I switched back to the iOS project and it would no longer even build:
```
error : clang++ exited with code 1:
error : Undefined symbols for architecture x86_64:
error : "_xamarin_is_object_valid", referenced from:
error :
error : "_xamarin_is_user_type", referenced from:
error :
error : ld: symbol(s) not found for architecture x86_64
error : clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

At this point, I manually deleted the `bin` and `obj` folders, built the project again and it all worked correctly, like it used to.
It looks like the MSBuild Clean target does not delete all files within those output folders and some old files are not compatible with the new build tools.

Specifically, when I clean the project from my IDE, JetBrains Rider, there are about 137MB of files left under `obj/Debug/net8.0-ios/iossimulator-x64`.
Interestingly, cleaning the project from the command line with `dotnet clean` does work as intended, all files in `obj/Debug/net8.0-ios` get deleted.

Looking at the MSBuild outputs, it looks like `CoreClean` is not deleting any file when invoked from the IDE.
Since I experienced the same symptoms with Visual Studio for Mac, I suspect there's an issue with the MSBuild script and this not a bug in Rider. From what I can see, it's just invoking the `Clean` target as it should.

### Steps to Reproduce

1. Build the project from the IDE
2. Clean the project from the IDE
3. Check bin/obj folders, observe there are still many files left

### Did you find any workaround?

Manually deleting the bin/obj folders fixes the build.

### Build logs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.