Bug 4412 - System.Reflection.TargetInvocationException occurs when adding an Existing file to a Project managed by Git
Summary: System.Reflection.TargetInvocationException occurs when adding an Existing fi...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: 2.9.x
Hardware: PC Mac OS
: High major
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-04-12 16:22 UTC by Eric Beisecker
Modified: 2012-04-17 14:06 UTC (History)
2 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 Eric Beisecker 2012-04-12 16:22:40 UTC
In MonoDevelop, if I try to add an existing file to a project that is managed by Git I get a TargetInvocationException. (Pasted Below)

Steps:
1) Open A Project managed bit Git (I did ContactManager in the monodroid-samples repo)
2) Right click on the Project Add->Add Files
3) Select a file and click 'Open'
4) Dialog appears with error

Versions
MonoDevelop 2.9.4
Runtime:
	Mono 2.10.9 (tarball Tue Mar 20 15:31:37 EDT 2012)
	GTK 2.24.10
	GTK# (2.12.0.0)

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Sharpen.EOFException: Input did not match supplied length. 2407744 bytes are missing.
  at NGit.Storage.File.ObjectDirectoryInserter.ToTemp (Sharpen.MessageDigest md, Int32 type, Int64 len, Sharpen.InputStream is) [0x00078] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/contrib/NGit/NGit.Storage.File/ObjectDirectoryInserter.cs:184 
  at NGit.Storage.File.ObjectDirectoryInserter.Insert (Int32 type, Int64 len, Sharpen.InputStream is) [0x0002d] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/contrib/NGit/NGit.Storage.File/ObjectDirectoryInserter.cs:101 
  at NGit.Api.AddCommand.Call () [0x001af] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/contrib/NGit/NGit.Api/AddCommand.cs:189 
  at MonoDevelop.VersionControl.Git.GitRepository.Add (MonoDevelop.Core.FilePath[] localPaths, Boolean recurse, IProgressMonitor monitor) [0x00046] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:768 
  at MonoDevelop.VersionControl.VersionControlService.OnFileAdded (System.Object s, MonoDevelop.Projects.ProjectFileEventArgs e) [0x000fb] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs:431 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Ide.RootWorkspace.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs:1107 
  at __ProjectFileEventHandler_DelegateFactory_3.Dispatch (System.Object ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Ide.Gui.GuiSyncContext.AsyncDispatch (MonoDevelop.Ide.StatefulMessageHandler cb, System.Object ob) [0x0000a] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/GuiSyncContext.cs:47 
  at __ProjectFileEventHandler_DelegateFactory_3.ProxyCall (System.Object , MonoDevelop.Projects.ProjectFileEventArgs ) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Projects.Solution.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x0000b] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs:716 
  at MonoDevelop.Projects.SolutionFolder.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00016] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:876 
  at MonoDevelop.Projects.SolutionFolder.NotifyFileAddedToProject (System.Object sender, MonoDevelop.Projects.ProjectFileEventArgs e) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs:743 
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at (wrapper delegate-invoke) <Module>:invoke_void__this___object_ProjectFileEventArgs (object,MonoDevelop.Projects.ProjectFileEventArgs)
  at MonoDevelop.Projects.Project.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs e) [0x00012] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:959 
  at MonoDevelop.MonoDroid.MonoDroidProject.OnFileAddedToProject (MonoDevelop.Projects.ProjectFileEventArgs args) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/md-addins/MonoDevelop.MonoDroid/MonoDevelop.MonoDroid/MonoDroidProject.cs:619 
  at MonoDevelop.Projects.Project.NotifyFileAddedToProject (IEnumerable`1 objs) [0x00084] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:891 
  at MonoDevelop.Projects.Project.OnItemsAdded (IEnumerable`1 objs) [0x00007] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs:826 
  at MonoDevelop.Projects.DotNetProject.OnItemsAdded (IEnumerable`1 objs) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1075 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x0009a] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:153 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectItem].MonoDevelop.Projects.IItemListHandler.InternalAdd (IEnumerable`1 objs, Boolean comesFromParent) [0x00041] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:127 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].NotifyAdded (IEnumerable`1 items, Boolean comesFromParent) [0x00082] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:151 
  at MonoDevelop.Projects.ProjectItemCollection`1[MonoDevelop.Projects.ProjectFile].AddRange (IEnumerable`1 items) [0x0003c] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItemCollection.cs:71 
  at MonoDevelop.Ide.ProjectOperations.AddFilesToProject (MonoDevelop.Projects.Project project, MonoDevelop.Core.FilePath[] files, MonoDevelop.Core.FilePath[] targetPaths, System.String buildAction) [0x003f5] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:1507 
  at MonoDevelop.Ide.ProjectOperations.AddFilesToProject (MonoDevelop.Projects.Project project, MonoDevelop.Core.FilePath[] files, FilePath targetDirectory, System.String buildAction) [0x00045] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs:1364 
  at MonoDevelop.Ide.Gui.Pads.ProjectPad.FolderCommandHandler.AddFilesToProject () [0x000bf] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/FolderNodeBuilder.cs:337 
  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) [0x00000] in <filename unknown>:0 
  --- 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) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Components.Commands.DefaultCommandHandler.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00018] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:2010 
  at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.Run (System.Object target, MonoDevelop.Components.Commands.Command cmd) [0x00000] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/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-mac-2.9.4/9b3ec72c/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-mac-2.9.4/9b3ec72c/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-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1898 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey49.<>m__58 () [0x0003d] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1038 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in /Users/builder/data/lanes/monodevelop-mac-2.9.4/9b3ec72c/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1055
Comment 1 Alan McGovern 2012-04-16 09:58:11 UTC
In order to reproduce this I'll need to know the exact file you tried adding to the solution too. I haven't been able to reproduce the problem with the information provided.
Comment 2 Eric Beisecker 2012-04-16 13:43:11 UTC
I'm trying to add the NativeDriver server JAR to a MonoAndroid project. 

Screencast: http://screencast.com/t/6Qw5WaZdqi
Comment 3 Alan McGovern 2012-04-16 18:13:06 UTC
It seems to be related to adding binary files to the repository
Comment 4 Alan McGovern 2012-04-17 14:06:06 UTC
This is fixed by updating monodevelops ngit to the latest version of jgit. I'm just testing the changes locally now to ensure there are no regressions but I expect to push them soon.