dotnet / dotnet/macios

Tooling is not removing a dll that is no longer referenced by code unless you rebuild

Open
#5,588 3 comments 0 reactions 0 assignees View on GitHub
bug iOS
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

### Steps to Reproduce
Make sure to have linking turned off

1. download the project
2. deploy ios app to device (I was deploying to a simulator)
3. comment out the following code in the AppDelegate
```C#
public void SomeRandomReference()
{
throw new Exception(typeof(ExtraLibrary.Class1).Name);
}
```
4. deploy ios app to device and you will notice that in the *AppDelegate.cs* file it's able to call *Assembly.Load("ExtraLibrary");* successfully
5. rebuild ios app
6. run ios app and now it will crash when trying to call *Assembly.Load("ExtraLibrary");*

### Expected Behavior
Behavior before rebuild should be the same as after rebuild

### Actual Behavior
A rebuild is required in order for the dll that's no longer referenced in code to not be included with the app

### Environment
```
Microsoft Visual Studio Enterprise 2019 Int Preview
Version 16.0.0 Preview 3.0 [28608.199.d16.0prev3]
VisualStudio.16.IntPreview/16.0.0-pre.3.0+28608.199.d16.0prev3
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Enterprise

Visual C++ 2019 00435-10000-00000-AA174
Microsoft Visual C++ 2019

Application Insights Tools for Visual Studio Package 9.0.20206.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2019 16.0.12185.18740
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.0.12185.18740
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.0.12185.18740
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 16.0.12185.18740
Azure Functions and Web Jobs Tools

C# Tools 3.0.0-beta3-19105-04+f9fc5ea40f861ac30e7ad1a322b7517d4af5d47b
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.77 (master@24013d5)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.0.0

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

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

Microsoft Library Manager 1.0
Install client-side libraries easily to any web project

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

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.0.300 (573eda3)
Support for debugging Mono processes with Visual Studio.

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

Project System Tools 1.0
Tools for working with C#, VisualBasic, and F# projects.

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

Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61901.26130
Microsoft SQL Server Data Tools

TypeScript Tools 16.0.10206.2003
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.0.0-beta3-19105-04+f9fc5ea40f861ac30e7ad1a322b7517d4af5d47b
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.4 for F# 4.6 16.0.0.0. Commit Hash: b5c01b8cc65af6381d2dd558ee63a4aa9e0e98d5.
Microsoft Visual F# Tools 10.4 for F# 4.6

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

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.0.0.433 (d16-0@949c8f6c5)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.17.287 (feb5c9860)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.0.330 (e66cdf3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 9.1.103.12 (HEAD/7e1c4688)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono/2018-08@725ba2a2523
Java.Interop: xamarin/java.interop/d16-0@c987483
LibZipSharp: grendello/LibZipSharp/master@44de300
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
MXE: xamarin/mxe/xamarin@b9cbb535
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.26.0@325e91a
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-0@f05c0aa

Xamarin.iOS and Xamarin.Mac SDK 12.6.0.16 (bc9c674)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
```

### Example Project (If Possible)

[PreserveTest.zip](https://github.com/xamarin/xamarin-macios/files/2853408/PreserveTest.zip)

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.