Build fails with “Operation not supported” and “Exception from HRESULT: 0x80131515”

Troubleshooting

Summary

Certain build steps fail unexpectedly with an “Operation not supported” error.
For a better user experience, please go to the integrated documentation viewer to read this article.

Description

One of the following error messages (or a similar one) may appear when trying to build an application using yFiles:

Could not load file or assembly 'yWorks.yFilesNET.Algorithms, Version=5.2.0.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

LC : error LC0000: 'Could not load file or assembly 'yWorks.yFilesWPF.Viewer' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)'

Cause

The underlying cause is that the yFiles assembly is marked as originating from the Internet Zone and thus a number of restrictions are placed on it. In this case this includes being unable to compile an application that tries to use a yFiles license. This marker is placed on downloaded files by browsers and is sometimes propagated into files extracted from downloaded archives, depending on the application used to extract the archive. The most common application that will propagate this marker when extracting a ZIP archive is Windows Explorer. Most standalone archivers will not do this.

Some applications, notably .NET's license compiler lc.exe and MSTest, will refuse to load an assembly from the internet zone, leading to the error shown above.

Solution

The easiest way to resolve this issue is to simply build one of the included demos or tutorials, preferrably one that references all assemblies you also need in your application (e.g. one of the “Complete” demos). The project file for all demos includes a target that will unblock the referenced yFiles assemblies automatically if they still require so.

You can also unblock the files manually:

  • Open the properties of the ZIP archive you downloaded
  • Check the Unblock checkbox next to the message “This file came from another computer and might be blocked to help protect this computer”:

  • Re-extract the contents of the ZIP archive again and overwrite the existing files

Alternatively you can just unblock the yFiles assemblies in the lib directory as described above. All other files in the distribution should be unaffected by having such a marker.

See also

  • KB736: A similar issue with the .NET Framework Resource Compiler, which prevents a successful build if .resx files in demos have a mark of the web.

Resources

Categories this article belongs to:
yFiles WPF > Other
yFiles.NET > Other
Applies to:
yFiles.NET: 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 6.0
yFiles WPF: 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 4.0
Keywords:
license compiler - license - licence - licence compiler - lc - lc.exe - build - exit code - LC0000 - assembly - load - error - HRESULT - 0x80131515 - 80131515 - operation is not supported - operation not supported - vstest.console.exe - mstest - vstest - mark of the web