xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.46k stars 511 forks source link

Multiple warnings shown when the ios extension project references the shared library #4449

Closed ColeXm closed 2 years ago

ColeXm commented 6 years ago

Enviroment : Visual studio for mac :7.5.2

Warning : The type “XYZ” in shared project “projectPath/SharedProject/XYZ.cs” conflicts with the imported type “XYZ” in “iOSNotificationExtensionProject”

There is a similar issue which was reported in the forum here .

VS bug #680550

VincentDondain commented 6 years ago

Please include your full build logs, crash reports (if any), test case (to reproduce) and all your version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:

On Visual Studio Windows you also want to add -v -v -v -v to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting Properties. Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

The easiest way to get exact version information:

Nishchithcp commented 6 years ago

We have a Xamarin iOS project. We wanted to support iOS notification extension and hence added iOSNotificationExtension project to the project. Now main project has an reference to iOSNotificationExtension project. We have shared project 'eg: BusinessLogicProject' which includes encryption/decryption and other shared code snippets. Now we want to use the decryption logic written in the BusinessLogicProject in iOSNotificationExtension project as well. Hence I added the reference of BusinessLogicProject in iOSNotificationExtension project. Note that the BusinessLogicProject is already added as the reference to main Xamarin iOS project. Hence we have reference of BusinessLogicProject in both main Xamarin iOS project and iOSNotificationExtension project.

When we build after adding all the references, multiple warnings are being shown in the file. Note that the warnings are not listed in the errors/warnings pad of the IDE. Its all listed in the file itself. Since it is a shared project we were expecting not to get any warnings or errors while referencing them in main project along with extension project.

If there is a class named: public class WaveList : List { } in the shared project. After adding the references I am getting following warning: "The type 'WaveList' in shared project 'projectPath/BusinessLogicProject/GenericTypeClass.cs' conflicts with the imported type 'WaveList' in 'iOSNotificationExtensionProject, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'projectPath/BusinessLogicProject/GenericTypeClass.cs'."

We are guessing the main project and the iOS notification extension project are maintaining separate instances of the shared library classes.

Kindly let us know if this has been resolved. And guide us to solve the warnings since we do not want to duplicate code in the shared project in extension project because of the warnings.

We came across a similar issue that was reported in the forum. It seems exactly like the following bug report which Xamarin claims to have fixed: https://bugzilla.xamarin.com/show_bug.cgi?id=44746

We are using following Visual Studio version: === Visual Studio Community 2017 for Mac ===

Version 7.5.2 (build 40) Installation UUID: 7667ca36-6ce4-4f12-89a5-69d739e152a6 Runtime: Mono 5.10.1.57 (2017-12/ea8a24b1bbf) (64-bit) GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

            Package version: 510010057

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: Not installed SDK: Not installed MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

'/Applications/Xamarin Profiler.app' not found

=== Xamarin.Android ===

Version: 8.1.5.0 (Visual Studio Community) Android SDK: /Users/nishchith.c.p/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 4.3 (API level 18) 7.1 (API level 25)

SDK Tools Version: 25.2.5 SDK Platform Tools Version: 25.0.5 SDK Build Tools Version: 25.0.3

Java SDK: /usr java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 9.4 (14160) Build 9F1027a

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 11.12.0.4 (Visual Studio Community) Hash: 64fece5f Branch: d15-7 Build date: 2018-05-29 20:00:44-0400

=== Xamarin Inspector ===

Version: 1.4.0 Hash: b3f92f9 Branch: master Build date: Fri, 19 Jan 2018 22:00:34 GMT Client compatibility: 1

=== Build Information ===

Release ID: 705020040 Git revision: cfe2fc0566bc4db990242959de40505a13f58352 Build date: 2018-05-30 11:24:18-04 Xamarin addins: 3ac7413ef51a88e06367313c27aec8f7292752a6 Build lane: monodevelop-lion-d15-7

=== Operating System ===

Mac OS X 10.13.4 Darwin 17.5.0 Darwin Kernel Version 17.5.0 Mon Mar 5 22:24:32 PST 2018 root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Team Foundation Version Control for TFS and VSTS 0.3.2

rolfbjarne commented 6 years ago

I can reproduce this in VSfM with the test case from bug #44746:

screenshot 2018-09-03 10 40 20
rolfbjarne commented 6 years ago

The warning does not show in up the build log, it's purely a UI issue.

SanthoshShettigar commented 6 years ago

Any update on this issue? I am also facing the same issue in Visual Studio Community 2017 for Mac Version 7.5.2 (build 40) and Xamarin iOS Version: 11.12.0.4.