Bug 8209 - PCL Building and Debugging problematic in VS2012
Summary: PCL Building and Debugging problematic in VS2012
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
: 9759 ()
Depends on:
Reported: 2012-11-04 10:29 UTC by Stuart Lodge
Modified: 2016-08-03 15:24 UTC (History)
18 users (show)

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 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:

Description Stuart Lodge 2012-11-04 10:29:34 UTC
I can build and debug PCLs with MonoDroid very well in VS2010

However, in VS2012 I am seeing a couple of problems:

- Often when I build a project then I need to do 2 builds - the first fails with lots of errors (mostly to do with 'namespace not found' for namespaces from the PCL library. However, the second build just works.
- When I try to debug a MonoDroid app which uses PCL then this debugging does not hit breakpoints set within the PCL.
- When I try to debug a MonoDroid app which uses PCL then if I step into the PCL, then the step fails to find the source code - so I just get the "no source code available" view.

To repro this, try the MvvmCross vNext branch - e.g. TwitterSearch.

Also reported via - http://forums.xamarin.com/discussion/286/pcl-debugging-in-vs2012
Comment 1 Stuart Lodge 2012-12-15 02:51:47 UTC
Just to confirm this is still an active problem.

Is there any status on this bug?

Is this:
- not reproducible?
- reproducible but won't be fixed - no timeline set?
- reproducible but not a Xamarin issue - so we need to talk to MS instead?
- more information requested?
- rejected due to some other issue

Sorry, if this feels like pestering. I'm not trying to subvert or redirect Xamarin engineering time - I love what you guys do. I am just trying to make sense of what to do with my own time.


Comment 2 Jon Stoneman 2013-01-21 08:20:51 UTC
I've not tried debugging with MonoDroid but can confirm that I've experienced the same problem when doing builds.  Having cleaned the solution I've just had:

Build 1
Loading assembly "C:\git\MvvmCross\bin\WinRT\Debug\System.Windows.dll" failed. System.IO.FileLoadException: Could not load file or assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)

Build 2
Lots of namespace exceptions such as:
The type or namespace name 'Interfaces' does not exist in the namespace 'Cirrious.MvvmCross' (are you missing an assembly reference?)	C:\git\MvvmCross\Cirrious\Cirrious.MvvmCross.Droid\Platform\MvxBaseAndroidSetup.cs
The type or namespace name 'IMvxViewModel' could not be found (are you missing a using directive or an assembly reference?)	C:\git\MvvmCross\Cirrious\Cirrious.MvvmCross.Droid\ExtensionMethods\MvxAndroidActivityExtensionMethods.cs

Build 3
No errors
Comment 3 dean.ellis 2013-03-13 15:03:01 UTC
Stuart, do you have a small sample we can use to replicate? I need to look at setting up Android PCL support on my dev machine so I can test this out.
Comment 4 Stuart Lodge 2013-03-13 16:50:35 UTC
Sorry Dean.

Not really got one - as I don't do small samples :)

For PCL debugging any of the Mvx samples will fail - e.g. in https://github.com/slodge/MvxTutorials

For build issues, go for the whole of Mvx vNext and then just try to build TwitterSearch.UI.Droid ? You can then probably cut out projects once you've got the repro?

Note: Build Issue 1 reported by JonStoneman above doesn't the same bug - that's to do with the Mvx Build tree (I think) so I think can be ignored.
Comment 5 Stuart Lodge 2013-03-13 16:51:09 UTC
Changing status (someone has to)
Comment 6 rbxam 2013-04-08 16:25:24 UTC
Since the fist version of Xamarin.Android 2.0, i have the same Problem.

But in my environment, the breakpoint didn't hit in VS2010 "and" VS2012.
Comment 7 Glen Lawson 2013-04-21 03:20:01 UTC
I'm also experiencing the same issues Stuart outlined. 

It's a bit disappointing that the breakpoints aren't firing in PCL code. The whole attraction of Xamarin for me is to to be able to take advantage of the power of Visual Studio and associated workflows.
Comment 8 Lucian POPESCU 2013-04-25 07:42:18 UTC
Still no update on this issue? It is really annoying not being able to debug PCLs. Is there someone else we should talk to or it is, in fact, a Xamarin issue? 

Xamarin version 4.0.3.
Comment 9 Jason Steele 2013-04-25 11:06:04 UTC
This is killing me. Any idea when this will be resolved guys?
Xamarin.Android 4.6.04000 VS2012.

Comment 10 Stuart Lodge 2013-04-25 11:19:42 UTC
Miguel has said that PCL support should arrive in approx 1 month.

I have no inside information about it.

Some words of caution:

- I would **guess** that there will be a couple of rounds of Alpha, then Beta before it becomes Stable
- I would **guess** that this will arrive in Xamarin Studio first, and then migrate to Visual Studio afterwards

Beyond that, I also have talked with one of the support guys about general VS debugging issues - I know that they said they had fixed a number of problems and that they were QAing those fixes. It might be worth one or more of us pinging support by email to ask for a timeline on these fixes - it may be that we don't need PCL support - we just need those other fixes.
Comment 11 dean.ellis 2013-05-02 09:05:59 UTC
I have been investigating this issue. It turns out that because the PCL libraries do not use the Xamarin msbuild targets it does not generate the .mdb files which are needed for debugging. 

I am working on a fix for this. Once completed the .mdb files will be generated from the existing .pdb files that the PCL library produces. This will allow the PCL libraries to be debugged.

Depending on the release cycle this fix may go into the Alpha or Beta channel.
Comment 12 dean.ellis 2013-05-02 12:18:22 UTC
Fixed in master/2fc29e9173
Comment 13 Jonathan Pryor 2013-05-28 12:22:48 UTC
*** Bug 9759 has been marked as a duplicate of this bug. ***
Comment 14 rlangton76 2013-06-25 17:41:40 UTC
Why does this say it's fixed yet it still doesn't work?  Is this not in the release build yet?
Comment 15 Jonathan Pryor 2013-06-26 17:00:55 UTC
@rlangton76: Which version have you tried? The fix for this bug was in the 4.7.5 alpha release.

You might try the current 4.7.9 beta release or the current 4.7.11 alpha release.

The fix for this will not be landing in the 4.6.x series.
Comment 16 Thomas Van Machelen 2013-07-08 04:25:28 UTC
I can confirm this is breakpoints are hit with the (now beta) 4.7.11 release.