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

5

14

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.

Sessile answered 21/5, 2015 at 19:16 Comment(1)
unless you luck out and someone reading has fixed this exact problem, you'll do better to include the smallest sample possible that illustrates this problem. Then anyone can apply their analytic skills to your problem. Good luck!Barr
Q
54

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.

Quadragesima answered 2/9, 2016 at 8:25 Comment(0)
L
4

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.

Lumen answered 9/6, 2015 at 12:59 Comment(3)
I opened the files in Notepad++ and changed from "Encode in UTF-8-BOM" to "Encode in UTF-8". It looks like having a BOM (Byte Order Mark) was confusing Studio 2013 and the XSLTRunnerup
@JohnDyer could be, or it could just be the fact that you changed the encoding.Lumen
@JonList As seen in my answer, this seems to be a problem with a security feature on files downloaded from the internet. So the encoding is probably a red herring. It's probably simply that modifying the file and resaving cleared the "downloaded from the internet" flag.Quadragesima
W
1

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.

Withal answered 4/4, 2016 at 13:53 Comment(0)
T
1

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

Teodoor answered 23/1, 2018 at 9:20 Comment(0)
R
0

For future visiters, none of the above solutions (even in Microsoft forums) didn't work for me. I did try in every VS version (including both professional and community versions) and nothing changed.

The only thing worked for me is:

1- Copy all the text in the XSL file

2- File(top left corner) -> New -> File -> XSLT File

3- Paste the text and run

This is the only way that worked for me.

Ribble answered 1/3, 2021 at 6:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.