Athari / XnaConvert

Utility for converting XNA XNB files (Texture2D to PNG images) [New BSD]
Other
48 stars 13 forks source link

Content loader error #2

Closed Alhifar closed 10 years ago

Alhifar commented 10 years ago

I'm running Windows 8.1 with .Net 4.5 and all of the XNA Frameworks installed. XNA games are functioning properly. When I try to run "C:\xnaconvert>alba.xnaconvert convert -r -d "F:\Games\Steam Library\SteamApps\co mmon\cthulhu saves the world" -o C:\CthuluFiles", I get "Content loader for 'XNA' with version '4.0' not found." despite having the XNA framework installed.

Athari commented 10 years ago

That message means that the program can't load Alba.XnaConvert.Loader.Xna40.dll. Please make sure that you've extracted all files, not just the main executable file. What happens if you run the following command line?

Alba.XnaConvert listlibs
Alhifar commented 10 years ago

I believe everything is extracted properly. xnaconvertfolder

C:\xnaconvert>Alba.XnaConvert listlibs Done!

Athari commented 10 years ago

Weird. The program can't load DLLs for some reason.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <system.diagnostics>
    <trace autoflush="true" indentsize="4"/>
    <sources>
      <source name="System.ComponentModel.Composition" switchValue="All">
        <listeners>
          <add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Composition.log"/>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>
Alhifar commented 10 years ago

System.ComponentModel.Composition Warning: 3 : The catalog 'DirectoryCatalog (Path=".")' could not load assembly 'C:\XNACONVERT\ALBA.XNACONVERT.LOADER.XNA10.DLL'. Could not load file or assembly 'Alba.XnaConvert.Loader.Xna10, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) System.ComponentModel.Composition Warning: 3 : The catalog 'DirectoryCatalog (Path=".")' could not load assembly 'C:\XNACONVERT\ALBA.XNACONVERT.LOADER.XNA20.DLL'. Could not load file or assembly 'Alba.XnaConvert.Loader.Xna20, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) System.ComponentModel.Composition Warning: 3 : The catalog 'DirectoryCatalog (Path=".")' could not load assembly 'C:\XNACONVERT\ALBA.XNACONVERT.LOADER.XNA30.DLL'. Could not load file or assembly 'Alba.XnaConvert.Loader.Xna30, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) System.ComponentModel.Composition Warning: 3 : The catalog 'DirectoryCatalog (Path=".")' could not load assembly 'C:\XNACONVERT\ALBA.XNACONVERT.LOADER.XNA31.DLL'. Could not load file or assembly 'Alba.XnaConvert.Loader.Xna31, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) System.ComponentModel.Composition Warning: 3 : The catalog 'DirectoryCatalog (Path=".")' could not load assembly 'C:\XNACONVERT\ALBA.XNACONVERT.LOADER.XNA40.DLL'. Could not load file or assembly 'Alba.XnaConvert.Loader.Xna40, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Alhifar commented 10 years ago

And after a little bit of googling on that error, looks like this is the issue: http://blogs.msdn.com/b/brada/archive/2009/12/11/visual-studio-project-sample-loading-error-assembly-could-not-be-loaded-and-will-be-ignored-could-not-load-file-or-assembly-or-one-of-its-dependencies-operation-is-not-supported-exception-from-hresult-0x80131515.aspx

Worked fine after setting the zip to "unblock" before extracting.

Athari commented 10 years ago

New version of the program will output warnings and errors from MEF to console. However, I have no idea how to programmatically check whether the program is being executed from an "untrusted" location.

Alhifar commented 10 years ago

For what it's worth, looks like this (http://stackoverflow.com/questions/6375599/looks-this-pinvoke-correct-and-reliable) is a way to get the files unblocked. Not sure what rights that requires to run though.

Athari commented 10 years ago

Looks like IZoneIdentifier COM interface can be used to both read and write zone information, without relying on implementation details. If that interface works for checking whether the app is being executed from a network path too, that would be great, because that's not the first time I see weird errors because of security. Just deleting the alternate stream won't work I suspect, because that should require the executable itself to be trusted.

How did you get untrusted files? Downloaded files from the Release tab on GitHub using Internet Explorer, then extracted files using Windows Explorer?

Alhifar commented 10 years ago

I downloaded the files from the release tab on GitHub using Chrome, then extracted them with WinRar.

Athari commented 10 years ago

Chrome added zone identifier to the downloaded file, but it didn't survive extracting with WinRAR. When extracting with Explorer, it was preserved.

Published new version v0.1.2 which includes zone check (and other minor improvements).