Bug 7082 - Adding files from to a project results in a System.Reflection.TargetInvocationException.
Summary: Adding files from to a project results in a System.Reflection.TargetInvocatio...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 3.0.x
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-09-11 23:56 UTC by Tom Opgenorth
Modified: 2012-09-18 11:28 UTC (History)
5 users (show)

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


Attachments
Created a little movie of how I caused the error. (3.29 MB, application/x-shockwave-flash)
2012-09-11 23:56 UTC, Tom Opgenorth
Details


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 Tom Opgenorth 2012-09-11 23:56:47 UTC
Created attachment 2507 [details]
Created a little movie of how I caused the error.

I'm trying to add two JAR files to a Mono for Android Java Binding Project. I right click on my Jars folder in my project, and then navigate to the folder in question.  I then click open, and check off the two JAR files in question.  When I click okay, the following exception gets thrown (and the JAR files are not added to my project):

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: path2
  at System.IO.Path.Combine (System.String path1, System.String path2) [0x000c6] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.IO/Path.cs:126 
  at MonoDevelop.Core.FilePath.Combine (System.String[] paths) [0x00014] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs:154 
  at MonoDevelop.MonoDroid.MonoDroidBindingProject.GetDefaultBuildAction (System.String fileName) [0x00055] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/MonoDroidBindingProject.cs:135 
  at MonoDevelop.Ide.ProjectOperations.AddFilesToProject (MonoDevelop.Projects.Project project, MonoDevelop.Core.FilePath[] files, MonoDevelop.Core.FilePath[] targetPaths, System.String buildAction) [0x0015f] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:1432 
  at MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderCommandHandler.AddFilesFromFolder () [0x000f8] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs:383 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MonoMethod.cs:226 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at MonoDevelop.Components.Commands.DefaultCommandHandler.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00018] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2017 
  at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CustomCommandTargetAttribute.cs:101 
  at MonoDevelop.Ide.Gui.Components.NodeCommandHandler+TransactedNodeHandlerAttribute.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00026] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeCommandHandler.cs:274 
  at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.MonoDevelop.Components.Commands.ICommandTargetHandler.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CustomCommandTargetAttribute.cs:58 
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00017] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1905 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey6E.<>m__B9 () [0x0003d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1045 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1062 



Here is the version information from MonoDevelop:


MonoDevelop 3.0.4.6
Installation UUID: 1dd14ec1-d5c9-4132-bd4f-f2b54777b748
Runtime:
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (2.12.0.0)
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.4.1 (1488)
	 Build 4F1003
Monotouch: 5.4.0
Mono for Android: 4.2.5
Android SDK: /Users/tom/android-sdk-macosx
	Supported Android versions:
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
Java SDK: /usr
Build information:
	Release ID: 30004006
	Git revision: 4df29c00c331aea1e86b2a08935bbd504261082b
	Build date: 2012-09-10 17:18:31+0000
	Xamarin addins: 75a3c9ec1a014eebf0f8346280ba8d7ad9629d3d-dirty
Operating System:
	Mac OS X 10.8.1
	Darwin sygin-2.local 12.1.0 Darwin Kernel Version 12.1.0
	    Tue Aug 14 13:29:55 PDT 2012
	    root:xnu-2050.9.2~1/RELEASE_X86_64 x86_64
Comment 1 Tom Opgenorth 2012-09-13 10:25:32 UTC
Tried this as well:

1. Copy the file to the folder in question
2. Select Options > Display All Files
3. Select the file in question, and then "Include in project"


Here is the error that is thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: path2
  at System.IO.Path.Combine (System.String path1, System.String path2) [0x000c6] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.10/_build/mono-2.10.10.git/mcs/class/corlib/System.IO/Path.cs:126 
  at MonoDevelop.Core.FilePath.Combine (System.String[] paths) [0x00014] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs:154 
  at MonoDevelop.MonoDroid.MonoDroidBindingProject.GetDefaultBuildAction (System.String fileName) [0x00055] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/MonoDroidBindingProject.cs:135 
  at MonoDevelop.Projects.Project.AddFiles (IEnumerable`1 files, System.String buildAction) [0x00026] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:335 
  at MonoDevelop.Projects.Project.AddFiles (IEnumerable`1 files) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:297 
  at MonoDevelop.Ide.Gui.Pads.ProjectPad.SystemFileNodeCommandHandler.IncludeFileToProject () [0x0014e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs:178 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d5] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.10/_build/mono-2.10.10.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:226 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.10/_build/mono-2.10.10.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:234 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.10/_build/mono-2.10.10.git/mcs/class/corlib/System.Reflection/MethodBase.cs:96 
  at MonoDevelop.Components.Commands.DefaultCommandHandler.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00018] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2017 
  at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CustomCommandTargetAttribute.cs:101 
  at MonoDevelop.Ide.Gui.Components.NodeCommandHandler+TransactedNodeHandlerAttribute.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00026] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/NodeCommandHandler.cs:274 
  at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.MonoDevelop.Components.Commands.ICommandTargetHandler.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CustomCommandTargetAttribute.cs:58 
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00017] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1905 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey6E.<>m__B9 () [0x0003d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1045 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-3.0.4-branch/4df29c00/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1062
Comment 3 Alan McGovern 2012-09-17 08:56:45 UTC
I think this has been fixed already. I can no longer reproduce the issue with ui-refresh. Could you double check with a newer build?
Comment 4 Alan McGovern 2012-09-18 08:34:01 UTC
I have the issue fixed, I just need to backport to all the relevant branches.