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.
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.
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:
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.
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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With