Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

MemoryMappedFile in Unity3D

Discussion in 'Scripting' started by DziD, Aug 23, 2011.

  1. DziD

    DziD

    Joined:
    Jan 20, 2010
    Posts:
    26
    Hello all!

    I try use MemoryMAppedFile in Unity 3.4, but I have fail, because MemoryMappedFile Class present only in .Net 4.0, (System.core.dll Places there C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll), and when I insert this assembly in my project, then I have a fail:
    PHP:
    Internal compiler errorSee the console log for more informationoutput was:warning CS1685The predefined type `System.Runtime.CompilerServices.ExtensionAttribute' is ambiguous. Using definition from `System.CoreVersion=2.0.5.0Culture=neutralPublicKeyToken=7cec85d7bea7798e'
    C:\\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\unity\System.Core.dll (Location of the symbol related to previous warning)
    D:\test\Assets\Plugins\System.Core.dll (Location of the symbol related to previous warning)

    Unhandled Exception: System.TypeLoadException: Could not load type '
    System.Runtime.AssemblyTargetedPatchBandAttribute' from assembly 'System.Core'.

      at (wrapper managed-to-native) System.Reflection.Assembly:InternalGetType (System.Reflection.Module,string,bool,bool)

      at System.Reflection.Assembly.GetType (System.String name, Boolean throwOnError, Boolean ignoreCase) [0x00000] in <filename unknown>:0 

      at System.Reflection.Assembly.GetType (System.String name) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.RootNamespace.GetTypeInAssembly (System.Reflection.Assembly assembly, System.String name) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.RootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.GlobalRootNamespace.LookupTypeReflection (Mono.CSharp.CompilerContext ctx, System.String name, Location loc, Boolean must_be_unique) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.Namespace.LookupType (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.Namespace.Lookup (Mono.CSharp.CompilerContext ctx, System.String name, Location loc) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.TypeManager.CoreLookupType (Mono.CSharp.CompilerContext ctx, System.String ns_name, System.String name, Kind type_kind, Boolean required) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.TypeManager.InitCoreTypes (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 

      at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

      at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
    Maybe anybody knows how to solve this?

    Or possible it or not?

    Thanks!
     
  2. Ntero

    Ntero

    Joined:
    Apr 29, 2010
    Posts:
    1,436
    You could be mangled up in dependencies. System.Core relies on mscorlib, which is now out of sync. So any references to new mscorlib classes will be broken.

    If you have Pro you can use the Native APIs to try to get MemoryMappedFiles working.

    This is actually a research task for me to do next, so if you try the Native APIs to any success lemme know and I'll mark this post and post if I make any headway.
     
  3. Ntero

    Ntero

    Joined:
    Apr 29, 2010
    Posts:
    1,436
    Also, you need to overwrite:
    C:\\Program Files (x86)\Unity\Editor\Data\Mono\lib\mono\unity\System.Core.dll
    as it is linking against System.Core 2.0 AND System.Core 4.0 as it states at the top of the error with the Ambiguous comment.
     
  4. Ntero

    Ntero

    Joined:
    Apr 29, 2010
    Posts:
    1,436
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    If it is .NEt 4.0 compiled it will never work. You need to ensure its a .NET 3.5 and lower compliant assembly, .NET 4 assemblies won't work as the compiled code is not compatbile with what unity supports (its not backward compatible)