Pergunta Debug xslt but need 3.5 runtime

  • Thursday, February 23, 2012 10:03 PM
     
     

    I do lots of xslt work including debugging.  Our xslt code makes calls into our 2.0/3.5 assemblies, and when it does this I get a platformnotsupportedexecption. My understadning is this happens because VS2010 by default will use the 4.0 runtime.

    I have seen some articles that talk about setting an app config but so far I can't get anything to work.  My best guess here is we need C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Xml\Microsoft.XslDebugger.Host.exe.config, and it should look something like this.  What am I missing?

    <configuration>
      <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
        <requiredRuntime version="v4.0.20506"/>
      </startup>
    </configuration>

All Replies

  • Thursday, February 23, 2012 10:13 PM
     
     
    The strange thing here is this works on one system that does not have this config file.  I don't know what is different yet between the two systems.  I can debug the same xslt, referencing the same assemblies, without issue.
  • Thursday, February 23, 2012 10:28 PM
     
     

    Another clue, both systems have Visual Studio 2010 Ultimate.

    The working system:

    Microsoft Visual Studio 2010
    Version 10.0.30319.1 RTMRel
    Microsoft .NET Framework
    Version 4.0.30319 RTMRel

    Installed Version: Ultimate

    Microsoft Visual C# 2010   01019-532-2002102-70327
    Microsoft Visual C# 2010

    The not working system:

    Microsoft Visual Studio 2010
    Version 10.0.30319.1 RTMRel
    Microsoft .NET Framework
    Version 4.0.30319 RTMRel

    Installed Version: Ultimate

    Microsoft Visual C# 2010   01019-532-2002102-70581

  • Friday, February 24, 2012 9:05 AM
    Moderator
     
     

    Excuse me, I would like to know when and where you got that PlatformNotSupportException and the screenshot, thanks!

    I mean, it seems a runtime problem instead of the Visual Studio debugger problem, maybe, I need to ensure this, to ensure we are always on the right way.

    Besides sharing the information we need, you also think it is a debugger problem at the moment, then please provide a reproducible Visual Studio solution, then zip it, share it through the "skydrive", then I can step into the problem you got. Since I almost have not wrote a XSLT project, thanks!


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us


  • Friday, February 24, 2012 3:15 PM
     
     

    Hi Mike,

    Sorry it is proprietary code and I cannot share a screenshot.  We reference some C# code within our xslt which then calls a function in one of our assemblies.  The error occurs when calling this function in the compiled assembly.

  • Tuesday, February 28, 2012 12:12 PM
    Moderator
     
     

    If you cannot share the whole Visual Studio solution, then you can help us to simplify the codes to generate a reproducible Visual Studio solution/project, delete the codes form your projects which not related to this problem, this is also an exclude way- a trouble-shooting method.

    Maybe you also can find the problem code line, and solve it yourself before you send the simplified projects to us.

    The problem Visual Studio solution will be necessary for us to repro and research this problem to find the real and root cause.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us


  • Tuesday, February 28, 2012 5:36 PM
     
     

    Thanks Mike, I found the problem code, it's where the C# code in our assembly connects to the SharePoint site.

    +  ex {"Exception of type 'System.PlatformNotSupportedException' was thrown."} System.Exception {System.PlatformNotSupportedException}

    I do not believe it is a problem with any code but rather how VS handles the code. The XSLT, C#, assemblies, and SharePoint all work really well together in the live system, this is a debugging issue. Why does one version of VS work and another version does not work against the same code?  What are the real differences between these two versions?

    It seems like the updated version that has the issue is trying to force the 4.x run time when I need it to run under 2/3, like the earlier version of VS apparently does.

    I appreciate your help but I feel like you are not listening/understanding what the issue is.  Here is a similar thread:

    http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/f0a7235b-a004-4cce-8833-b9dd6e5577b2

    Again, I am debugging an XSLT which uses embedded C# which then references/calls into a 2.0/3.5 assembly that talks with WSS 3.0.

    One version of Visual Studio 2010 handles this correctly, another newer version throws a System.PlatformNotSupportedException when hitting the SharePoint code. How do I get the newer version of VS to work like the older version?


    • Edited by R2SS Tuesday, February 28, 2012 5:39 PM
    •  
  • Wednesday, February 29, 2012 11:54 AM
    Moderator
     
     

    If I misunderstood you, then I'm sorry.

    But the thread you ref in your post, the problem seems a compile time error(from create the project to build the project, before try to F5 debug or run the project).

    Ok, now let's work.

    You said you cannot show me the screenshot, since it would capture your core codes, maybe, but you can use some image tool(mspaint.exe) to edit the image, to cover the codes you do not want others see.

    Why I always want the screenshot, I just want to know in which proceed the exception throw out, and the whole Visual Studio UI status, at the moment, since the information really not enough to analysis the root cause or give you a probable "guess" troubleshooting direction, which also makes us cannot find a door to look into the problem.

    And if there's a InnerException under this Exception, then I think it maybe can give us some clues. But the screenshot would be also helpful to narrow down the problem.


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us