Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Xml.Xsl.CompiledQuery.Query.staticData error when trying to debug XSLT in Visual Studio

I created a simple XSLT file using Visual Studio 2010 which works just fine on my machine. However, when my colleague tried to run it on her pc with Visual Studio 2013 it informed her that the file could not be ran and generated this message:

Attempt by method 'System.Xml.Xsl.XslCompiledTransform.Load(System.Type)' to access field 'System.Xml.Xsl.CompiledQuery.Query.staticData' failed.

However, when I did a simple copy of the text in my file and pasted it into a new blank XSLT file on her machine (with VS 2013) and saved it with a different name, then it runs just fine even though it is completely identical to my original. It's as if there's some reverse compatibility issue going on. Has anyone else experienced this and, if so, do you know of any permanent fix so we don't have to copy and paste all the time? The XSLT file is being run from a local drive.

like image 351
FordPrefect141 Avatar asked May 21 '15 19:05

FordPrefect141


People also ask

How do I debug XSLT transformation in Visual Studio?

You can start the debugger when you have either a style sheet or an input XML file open in the editor. This lets you debug as you're designing the style sheet. Open the style sheet or XML file in Visual Studio. Select Start XSLT Debugging from the XML menu or press Alt+F5.


4 Answers

Neither of the two answers here worked for me, but one of the workarounds in the now-deleted MS Connect bug report has worked for me on multiple occasions:

  1. Open the XSLT file's properties in Windows Explorer
  2. On the General tab, look for an Unblock button.
  3. Click it, then click OK

It seems like there's some kind of security feature in play here that detects that the file originated from another machine and it's fouling up something in the XSLT debugger.

like image 171
JLRishe Avatar answered Sep 21 '22 19:09

JLRishe


The issue for me was that the xslt file was on a network drive. Moving the file to a local drive on my machine fixed the problem.

Got the idea from Microsoft's feedback forum

like image 31
oracle certified professional Avatar answered Sep 23 '22 19:09

oracle certified professional


Changing the encoding from UTF-8 to ANSI (or any other encoding) and back to UTF-8 fixed it for me. Not much different than creating a new file, but a little bit easier.

like image 4
Jon List Avatar answered Sep 23 '22 19:09

Jon List


Encoding didn't work for me, but I've got a workaround. I get this error in VS 2015 so this bug has been around a while.

Don't do it this way: To test transforms I usually have the xslt open with the cursor in it and then, on the top menu, click xml->start xslt debugging->browse to the xml file

Do it this way: do it the opposite of above, that is, have the XML file open (not the xslt) then click xml->start xslt debugging->browse to XSLT file.

Not sure why it works, but it does.

like image 1
Tom McDonald Avatar answered Sep 21 '22 19:09

Tom McDonald