[BUG] Visual Studio 2015 going to crash every time I try to add services references in PCL project

I use Visual Studio 2015 on a Windows 10 Pro x64 ( Build 14393.351) and, when I try to add an ASMX service reference in a PLC project ( notice that I removed Win Phone 8.1 compatibility from PCL project and I don't have a Win Phone 8.1 project in solution), Visual studio going to crash during generation of service references client code and, after restart it, the service references aren't present in the project and in the Service Reference folder the file Reference.cs is missing. I've tried to add the same service reference in a simple console application and the the process finished correctly.

For example, I've created a test solution with the only PCL project ( no Android/iOS/Win project in this solution) and I've tried to add ( after removing support for WinPhone 8 compatibility in PCL project) a service reference to this ws: http://www.w3schools.com/xml/tempconvert.asmx but VS going to crash every time i make this. I've attached some screenshot about this.

Notice that I also tried on another pc with similar configuration (Visual Studio 2015 Pro on Win 10 Enterprise x64) and I have encountred the same issue.
I'm very afraid about this situation, anyone can help me or know a workaround for this problem?

Thank's in advance

This is my VS configuration:

Microsoft Visual Studio Community 2015 Version 14.0.25431.01 Update 3
Microsoft .NET Framework Version 4.6.01586
Xamarin 4.2.0.719 (15694b9)
Xamarin.Android 7.0.1.6 (5a02b03)
Xamarin.iOS 10.2.0.4 (b638977)

Posts

  • PietDelaPietDela USMember

    Same problem !!!

  • AliErenAliEren BEMember ✭✭

    +1

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    You need to add the Web reference to the individual platform-specific projects, not to the PCL project per the instructions found here.

  • fabiuz84fabiuz84 USMember ✭✭
    edited November 2016

    Hi @DaveHunt, thanks for your answer, but I think that your solution is based on a different approach, the service references in xamarin can be used in a PCL project. The problem that we encountered appears only on Visual Stuio 2015 ( and in Visual Studio 15 Preview), I've tried to replicate the bug in Visual Studio 2013 (on Win 10 x86) and in Xamarin Studio for MacOs and I don't have encountered any problem, I can add service references with success! After adding service references i've reopened the solution in Visual Studio 2015 and I've used it without problem, and when I've run the app on the device (Android & iPhone) I've invoked the services like in my intentions. Anyway this is a bug that made a lost of time for me and must be resolved.

  • JohannesHerterJohannesHerter USMember ✭✭
    edited November 2016

    @FabioPedretti
    I am facing the same issue while Updating an existing ServiceReference.
    Have you looked into the ActivityLog of Visual Studio? You might need to start VisualStudio with the log enabled:

    1. open a cmd window in the installation folder of Visual Studio (should be something like C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE)
    2. run the command devenv.exe /log (this should start Visual Studio)
    3. try to add the ServiceReference (VisualStudio will crash again)
    4. look into the ActivityLog.xml located in %AppData%\Microsoft\VisualStudio\14.0

    My log showed something like:
    Could not load file or assembly Microsoft.VisualStudio.Workspaces.Contracts

    I am currently repairing my VisualStudio installation. Reporting back when this is done.

    Edit: repairing VisualStudio did not help at all...

    Edit2: Seems like the crash only happens when I check "Reuse types in referenced assemblies" in the configuration. However, unchecking this option results in an incomplete reference that cannot be used.

  • fabiuz84fabiuz84 USMember ✭✭

    @JohannesHerter
    I've tried to do like you but in my ActivityLog I don't found any evidence about the crash, the final part of log is related only to "Information Event":

      <entry>
        <record>685</record>
        <time>2016/11/11 11:03:06.198</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>Entering function CVsPackageInfo::HrInstantiatePackage</description>
        <guid>{BC9CA0B3-BB4F-449A-967C-29A8FAE32086}</guid>
      </entry>
      <entry>
        <record>686</record>
        <time>2016/11/11 11:03:06.198</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>Begin package load [Microsoft VSDesigner WCF Package]</description>
        <guid>{BC9CA0B3-BB4F-449A-967C-29A8FAE32086}</guid>
      </entry>
      <entry>
        <record>687</record>
        <time>2016/11/11 11:03:06.217</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>End package load [Microsoft VSDesigner WCF Package]</description>
        <guid>{BC9CA0B3-BB4F-449A-967C-29A8FAE32086}</guid>
      </entry>
      <entry>
        <record>688</record>
        <time>2016/11/11 11:03:06.219</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>Entering function CVsPackageInfo::HrInstantiatePackage</description>
        <guid>{3807C10A-6B69-4525-9768-F7CF18D1D384}</guid>
      </entry>
      <entry>
        <record>689</record>
        <time>2016/11/11 11:03:06.219</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>Begin package load [Microsoft.VisualStudio.Editors.WcfPackage, Microsoft.VisualStudio.Editors.WCF, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
        <guid>{3807C10A-6B69-4525-9768-F7CF18D1D384}</guid>
      </entry>
      <entry>
        <record>690</record>
        <time>2016/11/11 11:03:06.237</time>
        <type>Information</type>
        <source>VisualStudio</source>
        <description>End package load [Microsoft.VisualStudio.Editors.WcfPackage, Microsoft.VisualStudio.Editors.WCF, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]</description>
        <guid>{3807C10A-6B69-4525-9768-F7CF18D1D384}</guid>
      </entry>
    </activity>
    

    and this is not helpful.

    Can you share your ActivityLog.xml?

    However, I opened a bug on bugtrace platform : https://bugzilla.xamarin.com/show_bug.cgi?id=46574

  • JohannesHerterJohannesHerter USMember ✭✭
    edited November 2016

    @FabioPedretti
    Sorry, I cannot share my ActivityLog.xml as I'm reinstalling Visual Studio at the moment and my log is already gone.

    You can also take a look into the ComponentModelCache error log (Microsoft.VisualStudio.Default.err) located in:
    AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

  • fabiuz84fabiuz84 USMember ✭✭

    I've make another test, I've removed from PCL Target platform ASP.NET Core 1.0 and I've added Silverlight 5 (I've added this only to prevent automatically reload of "ASP.NET Core 1.0 target" ) and I have added and updated the service references without problem!

  • JohannesHerterJohannesHerter USMember ✭✭

    Reinstallation of VisualStudio did not fix the issue for me.

    Changing the Target platform to Silverlight 5 prevents my visual studio from crashing. The generation of the service reference still fails (or rather generates an empty file).

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    Just to note, it is documented in a number of places that Xamarin only supports Silverlight. See, for example, Xamarin.iOS Assemblies and the WCF walkthrough also mentions this.

  • JohannesHerterJohannesHerter USMember ✭✭

    @DaveHunt You are right.
    However creating and updating my ServiceReference worked before and I see no reason why it should not work anymore. In addition it not only fails, but crashes my Visual Studio without any error message (this might not happen on xamarins side, but it's really annoying)

  • PietDelaPietDela USMember

    I confirm error resolved : I've removed from PCL Target platform ASP.NET Core 1.0 and I've added Silverlight 5 (I've added this only to prevent automatically reload of "ASP.NET Core 1.0 target" ) and I have added and updated the service references without problem!
    Thanks.

  • @PietDela Thank you so much, I've been looking for a solution for almost 1 month!

  • Just posting this if anyone have the same issue:
    After doing the target plataform changes, I started having this issue:

    The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

    To solve this I just undo the target plataform changes.

  • zaSabtizaSabti MAMember

    The best solution is to rename package.config to something like "package.old.config", remove windows phone silverlight from Targets and then rename your package to its old name.

Sign In or Register to comment.