0

I am using the XslCompiledTransformer in my web application. Unfortunately, this isn't working anymore with the latest .NET update, version 4.7. (I'm having this issue)

I hope Microsoft will come up with a solution quick, but in the meantime I want to force my application to run using .NET 4.6.

This is what I've already tried:

  • supportedRuntime tag in web.config file
  • Set the Target Framework of the webapplication project to .NET 4.6 / 4.5

Thank you for your answers!

Peter van Kekem
  • 1,387
  • 1
  • 12
  • 30
  • 2
    4.7 is an *in-place update* of the 4.x line. You'd have to uninstall 4.7 from the server to make this work. – Damien_The_Unbeliever Jun 19 '17 at 08:00
  • Unfortunately, that is not an option, since the application is rolled out to a lot of customers. We cannot go and uninstall .NET framework 4.7 on each and every one of them. – Peter van Kekem Jun 19 '17 at 10:15
  • I am creating an update for our software now to use `XslTransformer` instead of `XslCompiledTransformer` as a workaround, but that is of course bad for performance and therefore not preferable – Peter van Kekem Jun 19 '17 at 10:16
  • Did you try removing existing reference to System.xml.dll which is from `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7\System.Xml.dll` and adding it from folder `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Xml.dll?` Note : You can still keep application target framework as 4.7 if you like. – Pankaj Kapare Jun 19 '17 at 10:46
  • In addition to my above comment you may need to mark System.Xml.dll reference as "copy local". – Pankaj Kapare Jun 19 '17 at 10:54
  • Hi Pankaj, thank you for your answer, we already used a reference to the v4.5 folder, which wasn't helping. Also marking for Copy local and Specific version didn't help. In the meantime, with the new Windows 10 Creators Update, the `XslTransformer` is not working anymore as well. We found one other option: run the `XslCompiledTransformer` in debug mode, using `new XslCompiledTransformer(true);`. Still not the best solution, but it's workable... – Peter van Kekem Jun 21 '17 at 06:58

1 Answers1

2

You are running into a bug in tail recursion elimination in 4.7 jit. You can work around this issue by disabling the optimization: either set the environment variable COMPlus_TailCallLoopOpt to 0 or create a DWORD value named TailCallLoopOpt under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework or under HKEY_CURRENT_USER\SOFTWARE\Microsoft.NETFramework and set it to 0.

  • *Where* would one set this? Is it a compiler option? A setting to add to `web.config`? A registry setting? Something else? – Damien_The_Unbeliever Jul 12 '17 at 06:40
  • This is an environment variable. You can also set it to 0 in registry as DWORD value named TailCallLoopOpt under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework or under HKEY_CURRENT_USER\SOFTWARE\Microsoft\.NETFramework. – Eugene Rozenfeld Jul 12 '17 at 20:12
  • 1
    **Edit** your answer. Include this information. Include a link to more information, if such exists. As it stands, your answer, by itself, doesn't help anybody who doesn't know *exactly* what you're talking about already. – Damien_The_Unbeliever Jul 13 '17 at 05:59