msgpack / msgpack-cli

MessagePack implementation for Common Language Infrastructure / msgpack.org[C#]
http://msgpack.org
Apache License 2.0
834 stars 175 forks source link

can't generated serializers "Could not load file or assembly '...MsgPack.dll'" #185

Closed tametick closed 8 years ago

tametick commented 8 years ago

Hi, i've been using msgpack with my unity/webgl project using the msgpack.dll from https://github.com/msgpack/msgpack-cli/releases/ (version 0.8.0). It works fine in the editor but when trying to run in the browser it complains about missing serializers.

So I tried following the instructions on https://github.com/msgpack/msgpack-cli/wiki/Xamarin-and-Unity#generate-serializers, by downloading mpu and running the following command:

mpu.exe -s -a -n Slayaway.MsgPackSerializers -o "slayaway\Assets\MsgPackSerializers" "slayaway\Assets\Extensions\MsgPack.dll"

but am getting an error message:

C:\Users\idoye\Desktop>dir slayaway\Assets\Extensions\MsgPack.dll
 Volume in drive C is OS
 Volume Serial Number is B07D-9519

 Directory of C:\Users\idoye\Desktop\slayaway\Assets\Extensions

13/09/2016  10:03           398,848 MsgPack.dll
               1 File(s)        398,848 bytes
               0 Dir(s)  381,299,814,400 bytes free

C:\Users\idoye\Desktop>mpu.exe -s -a -n Slayaway.MsgPackSerializers -o "slayaway\Assets\MsgPackSerializers" "slayaway\Assets\Extensions\MsgPack.dll"
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\idoye\Desktop\slayaway\Assets\Extensions\MsgPack.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Users\idoye\Desktop\slayaway\Assets\Extensions\MsgPack.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at mpu.SerializerCodeGenerator.GenerateSerializers(String sourceAssemblyFile, String includingPattern, String excludingPattern) in C:\projects\msgpack-cli-x2p85\src\mpu\SerializerCodeGenerator.cs:line 77
   at mpu.Program.GenerateSerializers(IList`1 sourceFilePathes, String[] referenceAssemblies, Boolean sourceFileIsAssembly, String includingPattern, String excludingPattern, Boolean treatWarningsAsErrors, Int32 warningLevel, SerializerCodeGenerationConfiguration configuration) in C:\projects\msgpack-cli-x2p85\src\mpu\Program.cs:line 323
   at mpu.Program.Execute(IEnumerable`1 args) in C:\projects\msgpack-cli-x2p85\src\mpu\Program.cs:line 221
   at mpu.Program.Main(String[] args) in C:\projects\msgpack-cli-x2p85\src\mpu\Program.cs:line 41

any idea what I'm doing wrong?

tametick commented 8 years ago

Sorry I'm dumb! mpu expects my serializable classes as the 2nd paramter not the msgpack dll...works fine now

yfakariya commented 8 years ago

No problem :)