Bug 51746 - Allow missing referenced assemblies in NSApplication launch as option
Summary: Allow missing referenced assemblies in NSApplication launch as option
Status: RESOLVED FIXED
Alias: None
Product: Xamarin.Mac
Classification: Desktop
Component: Library (Xamarin.Mac.dll) ()
Version: 3.0.0 (C9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: (C10)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-01-24 22:29 UTC by Chris Hamons
Modified: 2017-02-22 15:25 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Chris Hamons 2017-01-24 22:29:00 UTC
XS really would like to be able to turn this warning/error off:

		static void CollectReferencedAssemblies (List<Assembly> assemblies, Assembly assembly)
		{
			assemblies.Add (assembly);
			foreach (var rf in assembly.GetReferencedAssemblies ()) {
				try {
					var a = Assembly.Load (rf);
					if (!assemblies.Contains (a))
						CollectReferencedAssemblies (assemblies, a);
				}
#if MONOMAC
				catch {
					// that's more important for XI because device builds don't go thru this step
					// and we can end up with simulator-only failures - bug #29211
					throw;
#else
				catch (FileNotFoundException fefe) {
					NSLog ("Could not find `{0}` referenced by assembly `{1}`.", fefe.FileName, assembly.FullName);
#endif
				}
			}
		}


Let's add another NSApplication setting to allow experts to know what they are doing.
Comment 1 Chris Hamons 2017-01-24 22:29:42 UTC
Maybe SR1 to make his life easier.
Comment 2 Alan McGovern 2017-01-24 22:30:07 UTC
Just adding the actual error:

[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'Xwt.XamMac' or one of its dependencies
File name: 'Xwt.XamMac'
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00081] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/AppDomain.cs:746 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
  at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System/AppDomain.cs:714 
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
  at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/Assembly.cs:596 
  at ObjCRuntime.Runtime.CollectReferencedAssemblies (System.Collections.Generic.List`1[T] assemblies, System.Reflection.Assembly assembly) [0x0001d] in <fc5e1fa5f40e47b7ab6a305f19513423>:0
Comment 4 Chris Hamons 2017-02-01 19:23:15 UTC
Moving to C10 since we might not have an SR1
Comment 5 Chris Hamons 2017-02-22 15:25:03 UTC
Fixed via https://github.com/xamarin/xamarin-macios/pull/1709