Bug 16690 - Edit References failed
Summary: Edit References failed
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: 4.2.x
Hardware: PC Windows
: High major
Target Milestone: 4.2.3 (from master)
Assignee: Mikayla Hutchinson [MSFT]
URL:
: 17148 17261 ()
Depends on:
Blocks:
 
Reported: 2013-12-10 03:10 UTC by Dylan
Modified: 2014-01-16 00:28 UTC (History)
5 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:
VERIFIED FIXED

Description Dylan 2013-12-10 03:10:22 UTC
I'm trying to add a reference to an Android application. It's a brand new solution. The assemblies do in fact exist and other projects use them. I get this error for every single reference I try to add.

I get the following error when adding them:


System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'ServiceStack.Interfaces.Android, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.ReflectionOnlyLoad(String assemblyString)
   at IKVM.Reflection.Universe.DefaultResolver(String refname, Boolean throwOnError)
   at IKVM.Reflection.Universe.Load(String refname, Module requestingModule, Boolean throwOnError)
   at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRefImpl(Record& rec)
   at IKVM.Reflection.Reader.ModuleReader.ResolveAssemblyRef(Int32 index)
   at IKVM.Reflection.Reader.ModuleReader.ResolveType(Int32 metadataToken, IGenericContext context)
   at IKVM.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at IKVM.Reflection.Module.ResolveType(Int32 metadataToken)
   at IKVM.Reflection.Reader.ModuleReader.__GetReferencedTypes()
   at MonoDevelop.MonoDroid.MonoDroidProject.<IsAssemblyCallingJavaCode>b__1(Module m)
   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MonoDevelop.MonoDroid.MonoDroidProject.IsAssemblyCallingJavaCode(String file)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at MonoDevelop.MonoDroid.MonoDroidProject.ValidateReference(XamarinEntitlements entitlements, ProjectReference reference)
   at Xamarin.Ide.ActivationHelper.FindReferencesRequiringUpgrade(IXamarinProject project, XamarinEntitlements entl, List`1 references, List`1& reasons, List`1& delayedReferences)
   at Xamarin.Ide.ActivationHelper.ReferenceValidator(Object sender, EditReferencesEventArgs e)
   at MonoDevelop.Ide.ProjectOperations.AddReferenceToProject(DotNetProject project)
   at MonoDevelop.Ide.Gui.Pads.ProjectPad.ProjectReferenceFolderNodeCommandHandler.AddReferenceToProject()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at MonoDevelop.Components.Commands.DefaultCommandHandler.Run(Object target, Command cmd)
   at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.Run(Object target, Command cmd)
   at MonoDevelop.Ide.Gui.Components.NodeCommandHandler.TransactedNodeHandlerAttribute.Run(Object target, Command cmd)
   at MonoDevelop.Components.Commands.CustomCommandTargetAttribute.MonoDevelop.Components.Commands.ICommandTargetHandler.Run(Object target, Command cmd)
   at MonoDevelop.Components.Commands.CommandHandlerInfo.Run(Object cmdTarget, Command cmd)
   at MonoDevelop.Components.Commands.CommandManager.<>c__DisplayClassb.<DispatchCommand>b__2()
   at MonoDevelop.Components.Commands.CommandManager.DispatchCommand(Object commandId, Object dataItem, Object initialTarget, CommandSource source)
Comment 1 Dylan 2013-12-10 03:11:22 UTC
Xamarin Studio 4.2.2
Comment 2 Mohit Kheterpal 2013-12-10 10:02:10 UTC
Today we have tried to reproduce this issue via following steps :

1. Open XS
2. Create Android sample application.
3. Add reference via right click on references folder and select edit references.
(As shown in screencast)

Screencast : http://screencast.com/t/AH6KU83e54O

We are not sure about the steps. Could you please provide us steps or sample application? 
So that we can reproduce this issue.
Comment 3 Mikayla Hutchinson [MSFT] 2013-12-10 13:02:57 UTC
This happens for iOS and Android projects when the licenses edition is Starter or Indie. It's a regression introduced by the licensing changes in 4.2.x. I fixed in in md-addins/e36586f751cc83737acf59b09f6746444916177f (Mon, 11 Nov) but it hasn't yet made it into a release.
Comment 4 Mikayla Hutchinson [MSFT] 2013-12-10 15:22:22 UTC
Until a fix is released, it should be possible to work around the bug by manually editing the project file when adding references:

1. Right-click on the Project -> Tools -> Edit File

2. Find the <ItemGroup> that contains <Reference> items

3. Add your new item to this section as follows:

<Reference Include="$NAME"><HintPath>$PATH</HintPath></Reference>

Where $NAME is the name of the assembly, and $PATH is the project-relative path, using Windows '\' path separators.
Comment 5 Akhilesh kumar 2014-01-03 12:58:29 UTC
Today we have checked this issue with following builds :

XS 4.2.3 (build 23)

We are able to add reference via right click on references folder and select edit
references successfully. As mentioned in comment 3, this issue exist with *starter* license, so we have checked this issue with starter license. And it is working fine.

Screencast : http://screencast.com/t/peEHK48yOIHz

Hence closing this issue.

Please let us know if we have to check to something else.
Comment 6 Mikayla Hutchinson [MSFT] 2014-01-09 15:47:49 UTC
*** Bug 17148 has been marked as a duplicate of this bug. ***
Comment 7 Mikayla Hutchinson [MSFT] 2014-01-16 00:28:47 UTC
*** Bug 17261 has been marked as a duplicate of this bug. ***