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.
Created attachment 12462 [details] Test case [XF 1.4.4] Modifying XAML files causes IntelliSense for references to other PCLs to fail in the ".xaml.cs" codebeind files with errors of the form "are you missing an assembly reference?" ## Regression status: regression between 1.4.3 and 1.4.4 BAD: XF 1.5.0.6396-pre1 BAD: XF 1.4.4.6392 GOOD: XF 1.4.3.6376 My guess would be that this is a side-effect of the new `.g.cs` generator logic and therefore closely related to the fix for Bug 32341. ## About the test case This is a new app created from scratch to imitate the setup of one of the XAML pages in the "XLabs.Sample" project from the XLabs repo [1]. > [1] https://github.com/XLabs/Xamarin-Forms-Labs ## Steps to reproduce 1. Open the attached test case. 2. Restore the NuGet packages. 3. Make a modification to the `Page1.xaml` file and save it. It is sufficient just to overwrite "Page1" with "Page1" and save the file. 4. Navigate to the `Page1.xaml.cs` file to check the IntelliSense status of the "BaseView" type and the "XLabs.Forms" namespace. ## Results The "BaseView" type and the "XLabs.Forms" names cannot be found. ### Error messages from "View -> Error List" > The type or namespace name 'Forms' does not exist in the namespace 'XLabs' (are you missing an assembly reference?) > The type or namespace name 'BaseView' could not be found (are you missing a using directive or an assembly reference?) ## Additional notes - If you remove the `MSBuild:UpdateDesignTimeXaml` "Custom Tool" on "Page1.xaml", clean the project, and then close and reopen the solution, the "BaseView" and "XLabs.Forms" names _will_ be found. - Building the project succeeds without error. It is only the IntelliSense that produces these "false" error messages. - The problem only affects Visual Studio. It does not affect Xamarin Studio on Windows. ## Additional version info (brief) ### Windows 8.1 (64-bit) in VMWare Fusion 6.0.6 Microsoft Visual Studio Professional 2013 Version 12.0.40629.00 Update 5 Microsoft .NET Framework Version 4.6.00081 Xamarin 3.11.836.0 (ed5c750)
Created attachment 12472 [details] Zip Xamarin Logs I have checked this issue with the help of test steps given in bug description and able to reproduce the reported behavior. Screencast : http://www.screencast.com/t/FEtsBHA8hn Environment Info : Xamarin.Forms.1.5.0.6396-pre1 Microsoft Visual Studio Professional 2013 Version 12.0.31101.00 Update 4 Microsoft .NET Framework Version 4.5.50938 Installed Version: Professional Xamarin 3.11.868.0 (d98cdcb)
Are there any updates on this issue? We have a project with a large number of screens built in XAML and can't upgrade past 1.4.3.6376 because of it. We also can't work in Xamarin Studio due to C#6 features that aren't implemented yet. Xamarin.Forms > 1.4.3.6376 Microsoft Visual Studio Professional 2015 Version 14.0.23107.0D14REL Microsoft .NET Framework Version 4.6.00081 Xamarin 3.11.1537.0 (a11147b)
I can't believe this has been a known issue for 4 months and has not been fixed. I understand that it is not an impediment to building but for those of us who live (and BTW, pay extra to use Xamarin in VS) this is a huge problem. I live in VS all day and this is just a thorn in my side and really is starting to make coding anything with slightly complex architectures annoying as hell.
## Possible partial workaround for VS 2015 Update 1 users For any users running VS 2015 Update 1, there is a chance that switching to using VS 2015 Update 1's built-in Xamarin.Forms IntelliSense [1] might help. [1] https://visualstudiogallery.msdn.microsoft.com/8195a8e2-a842-4389-a8cb-34e4672e2e13
*** Bug 36657 has been marked as a duplicate of this bug. ***
*** Bug 37413 has been marked as a duplicate of this bug. ***
Is there any info on this bug? Its been 5 months+ now and the posted work around does nothing especially for those of us who use Resharper, which I would assume is a large portion of the user group. I even tried disabling Resharper because I find it nearly impossible to work since my projects have many assemblies that are used in xaml markup for extensions, controls, converters, etc. Every time I make a xaml change and save it, so much of my editor page goes red with errors its almost impossible to keep working without doing a clean and rebuild. Clean and rebuild takes a long time and slows all work down. I think the importance of this bug should be escalated to something more than "normal".
@Jason Michas I totally agree with you, this is a pain in the butt.
Just for cross-referencing, I'll record that there is a small status update on the investigation for this issue in the bug that this bug "depends on": Bug 33181, Comment 26 To summarize briefly, the engineers have started digging into the issue.
## Verification status: not yet fixed on the latest published versions BAD: XF 2.1.0.6526 + XamarinVS 99.0.0.1562 (a9dd59b) BAD: XF 2.0.0.6482 + XamarinVS 99.0.0.1562 (a9dd59b) Tested on both Visual Studio 2013 Update 3 and Visual Studio 2015 Update 1. I first tested with the original steps from Comment 0. That still showed the original problem. Then I tried creating a new solution from scratch. That also showed the problem. ## Steps followed to replicate "from scratch" 1. Create a new "Visual C# -> Cross-Platform -> Blank App (Xamarin.Forms Portable)" app named "FormsPortable1". 2. Add a "Visual C# -> Cross-Platform -> Class Library (Xamarin.Forms)" library named "PortableClassLibrary1" to the solution. 3. Add a reference to "PortableClassLibrary1" in the "FormsPortable1" portable library (that was created during step 1). 4. Add a "Visual C# -> Cross-Platform -> Forms Xaml Page" file named "Page1" to the "FormsPortable1" library. 5. Open `Page1.xaml.cs` and change the base class from `ContentPage` to `PortableClassLibrary1.PortableClassLibrary1`. 6. Wait for the IntelliSense to recognize `PortableClassLibrary1.PortableClassLibrary1` as a recognized type. This might take a few moments. Now proceed with the original steps to replicate from Comment 0: 7. Make a modification to the `Page1.xaml` file and save it. It is sufficient just to overwrite the string "Page1" with "Page1" and save the file. 8. Navigate to the `Page1.xaml.cs` file to check the IntelliSense status of the "PortableClassLibrary1" namespace. ## Results The "PortableClassLibrary1" namespace cannot be found. ### Error messages from "View -> Error List" > Error CS0246 The type or namespace name 'PortableClassLibrary1' could > not be found (are you missing a using directive or an assembly > reference?) > FormsPortable1 > c:\source\FormsPortable1\FormsPortable1\FormsPortable1\Page1.xaml.cs ## Evaluation of possible workarounds ### Bug 33181, Comment 30: only helps temporarily > The simple workaround is to remove and re-add the references from the > App projects to the PCL. Removing the reference that I added during step 3 and then repeating step 3 does _temporarily_ switch the error messages back to their original state from after step 6 [1]. But repeating step 7 causes the errors to switch right back. Unfortunately that means the workaround is not too helpful. [1] The "namespace ... could not be found" error goes away, and the `InitializeComponent` error from Bug 33181 re-appears. ### Bug 33181, Comment 22: has no effect The suggested `.targets` file helps with the `InitializeComponent` error (Bug 33181), but it has _no effect_ on the behavior of _this_ bug (Bug 32988) for types and namespaces in PCL references.
The precise changes that introduced this bug are the modifications to `Xamarin.Forms.targets` from the following 2 commits: 0bb8c1e707273043ca522970bf206bb12a1c10d3 (Bug 29501) 7bf0bbead90c0383abdeefe376952357a9e04303 (Bug 32341) ## Workaround to revert those 2 commits by hand and apply an alternate fix for Bug 29501 and Bug 32341 1. Open `packages\Xamarin.Forms.*\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets` in the Visual Studio text editor. (Replace `*` with the Xamarin.Forms version you're using. If you're using VS 2015 Update 1, you can instead make the changes in "%USERPROFILE%\.nuget\packages\Xamarin.Forms\*\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets". Then the changes will propagate any time you install that cached version of the package.) 2. Replace `PrepareResources` with `Compile` in the following lines: <PrepareResourcesDependsOn> XamlG; $(PrepareResourcesDependsOn); </PrepareResourcesDependsOn> ... to change it back to: <CompileDependsOn> XamlG; $(CompileDependsOn); </CompileDependsOn> 3. Remove `PrepareResources;` from the following line: <Target Name="UpdateDesignTimeXaml" Condition="'$(UseHostCompilerIfAvailable)' == 'true'" DependsOnTargets="PrepareResources; Compile"/> ... to change it back to: <Target Name="UpdateDesignTimeXaml" Condition="'$(UseHostCompilerIfAvailable)' == 'true'" DependsOnTargets="Compile"/> 4. Add `BeforeTargets="XamlPreCompile"` to the following line: <Target Name="XamlG" DependsOnTargets="$(XamlGDependsOn)"/> ... to change it to: <Target Name="XamlG" BeforeTargets="XamlPreCompile" DependsOnTargets="$(XamlGDependsOn)"/> (See Bug 39827, Comment 3 for additional information about this last change.) ## Results after making these changes (Tested with Xamarin.Forms 2.1.0.6529, except where otherwise noted.) Bug 29501 - GOOD (Tested with Xamarin.Forms 2.1.0.6526) Bug 32341 - GOOD Bug 32988 - GOOD Bug 33181 - GOOD Bug 39827 - GOOD ## Remaining Questions Of course, this workaround does not directly address the question of why running `PrepareResources` causes the Xamarin.Forms PCL project to temporarily "forget" the references to the secondary PCL project. So if the `PrepareResources` approach still has some important advantages over this alternate `XamlPreCompile` approach, then further investigation will be needed.
I am unable to get this workaround to work. I am using 2.1.0.6529. I made the changes to the targets file as described in comment #18. I did a clean and rebuild so all references were displayed as working and known to VS. I opened a Xaml page and added a space and removed it to force a change. I saved the page and all the external PCL references in the Xaml file lit up red and were then unknown to VS. All intellisense for the external PCLs stopped working.
Jason Michas, replace Xamarin.Forms.targets with this: https://gist.github.com/victorarce/8f42ae855457275d1924 and restart Visual Studio.
@Brendan did you test in Xamarin Studio with that fix?
@Jason, excellent point. Testing the `BeforeTargets="XamlPreCompile"` approach in Xamarin Studio on Mac does indeed reveal some problematic warnings because there is no `XamlPreCompile` target in that environment. One possible alternative might be to discard `BeforeTargets="XamlPreCompile"` (step 4), and then use `CoreCompileDependsOn` rather than `CompileDependsOn` at step 2: <CoreCompileDependsOn> XamlG; $(CoreCompileDependsOn); </CoreCompileDependsOn> Step 3 stays the same: <Target Name="UpdateDesignTimeXaml" Condition="'$(UseHostCompilerIfAvailable)' == 'true'" DependsOnTargets="Compile"/> This seems to preserve all of the desired "good" behaviors in Xamarin Studio and Visual Studio that I have tested so far. Note to users watching this bug: A strong caveat is that at the moment the only evidence I am providing to support either this approach or the approach from Comment 18 is direct experimentation. To put it another way, I am not certain of the complete flow of execution through the targets when performing a "full" build or when updating the `.g.cs` files. So this approach might break some other scenarios that I haven't tried. ## Results with this slightly different approach Bug 29501 - GOOD Bug 32341 - GOOD Bug 32988 - GOOD Bug 33181 - GOOD Bug 39827 - GOOD Best, Brendan Xamarin Customer Support
Sorry, its been a while since Ive been able to tinker with a Xamarin project. It seems that using the gist in comment #21 by victor does indeed fix the problem for me. Doing exactly the same steps as I described before (comment #20) no longer breaks all the references to external PCLs. This is awesome.
## Verification status: verified fixed on Xamarin.Forms 2.2.0.5-pre2 GOOD: Xamarin.Forms 2.2.0.5-pre2 BAD: Xamarin.Forms 2.1.0.6529
@Brendan, is there a possible ETA for when Xamarin.Forms 2.2.0.5-pre2 will be availible on a nu-get package?
@Daniel Mercer, its already on NuGet. Just be sure you checked "Include Pre-Releases" option in package manager to get pre-2. btw, I'm using VS2015. Thanks @Brendan
Hi @Victor & @Brendan, Thanks, After installing this I now end up with the following errors 2>------ Build started: Project: ProjMobile.Droid, Configuration: Release Any CPU ------ 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(348,2): error XA5207: Please install package: 'GPS AppIndexing' available in SDK installer. Java library file C:\Users\Daniel\AppData\Local\Xamarin\GooglePlayServices.AppIndexing\8.4.0\embedded\classes.jar doesn't exist. 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(348,2): error XA5206: Please install package: 'GPS AppIndexing' available in SDK installer. Android resource directory C:\Users\Daniel\AppData\Local\Xamarin\GooglePlayServices.AppIndexing\8.4.0\embedded\./ doesn't exist. 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(348,2): error XA5207: Please install package: 'GPS Base' available in SDK installer. Java library file C:\Users\Daniel\AppData\Local\Xamarin\GooglePlayServices.Base\8.4.0\embedded\classes.jar doesn't exist. 2>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(348,2): error XA5206: Please install package: 'GPS Base' available in SDK installer. Android resource directory C:\Users\Daniel\AppData\Local\Xamarin\GooglePlayServices.Base\8.4.0\embedded\./ doesn't exist. ========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ========== cant seem to get past this now.. checked with the SDK manager, I have the latest SDK's installed for 6.0 android and all the additional google play services installed. I've also tried installed them via the NuGet packages but again that doesn't seem to fix it either. any suggestions?
@Daniel Mercer, sorry to hear that. I had only tested on iOS, but I just did Droid and even tough it updated a lot of android dependencies, it compiled OK. It looks like you have a problem only with "GPS AppIndexing"... try the usual: clean, reinstall, etc. Try removing it to see if thats the only problem.