Using 1.13.222.0 (.NET 3.5) Stuck in tutorial

109 views
Skip to first unread message

Tyhja Tchlstkov

unread,
Apr 15, 2014, 8:31:44 AM4/15/14
to re-moti...@googlegroups.com
Hi,
I'm excited to finally find mixin's in C#. Due to certain limitations I'm limited to .NET 3.5.
I mostly figured out how to use the tutorial in the old context, however I get stuck with this error:

ArgumentNullException: Argument cannot be null.
Parameter name: baseDirectory
Remotion.Utilities.ArgumentUtility.CheckNotNull[String] (System.String argumentName, System.String actualValue)
Remotion.Utilities.ArgumentUtility.CheckNotNullOrEmpty (System.String argumentName, System.String actualValue)
Remotion.Reflection.TypeDiscovery.AssemblyFinding.SearchPathRootAssemblyFinder..ctor (System.String baseDirectory, System.String relativeSearchPath, Boolean considerDynamicDirectory, System.String dynamicDirectory, IAssemblyLoader assemblyLoader)
Remotion.Reflection.TypeDiscovery.AssemblyFinding.SearchPathRootAssemblyFinder.CreateForCurrentAppDomain (Boolean considerDynamicDirectory, IAssemblyLoader assemblyLoader)
Remotion.Configuration.TypeDiscovery.TypeDiscoveryConfiguration.CreateServiceWithAutomaticDiscovery ()
Remotion.Configuration.TypeDiscovery.TypeDiscoveryConfiguration.CreateTypeDiscoveryService ()
Remotion.Reflection.TypeDiscovery.ContextAwareTypeDiscoveryUtility.get_DefaultNonDesignModeService ()
Remotion.Reflection.TypeDiscovery.ContextAwareTypeDiscoveryUtility.GetTypeDiscoveryService ()
Remotion.Mixins.Context.DeclarativeConfigurationBuilder.GetTypeDiscoveryService ()
Remotion.Mixins.Context.DeclarativeConfigurationBuilder.BuildDefaultConfiguration ()
Remotion.Mixins.MixinConfiguration.BuildMasterConfiguration ()
Remotion.DoubleCheckedLockingContainer`1[Remotion.Mixins.MixinConfiguration].get_Value ()
Remotion.Mixins.MixinConfiguration.GetMasterConfiguration ()
Remotion.SafeContextSingleton`1[Remotion.Mixins.MixinConfiguration].get_Current ()
Remotion.Mixins.MixinConfiguration.get_ActiveConfiguration ()
Remotion.Mixins.CodeGeneration.ObjectFactoryImplementation.CreateInstance (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create[StreetAddress] (Boolean allowNonPublicConstructors, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
EqualsShowCase.MixinImplementation.StreetAddress.NewObject (Int32 zipCode, System.String city, System.String street, System.String streetNumber) (at Assets/Scripts/MixInTesting/AddressTest.cs:95)

which stems from a null error triggered deep in the assembly (this is following the tutorial exactly). I hope i could get some quick pointers perhaps on what exactly should I do to modify the tutorial code so I can get a working sample.
Thanks a lot in advance for any advice.

Michael Ketting

unread,
Apr 16, 2014, 3:13:53 AM4/16/14
to re-moti...@googlegroups.com
Hello Tyhja!

Glad you dig the mixins :)

It appears that AppDomain.CurrentDomain.BaseDirectory is null. Could you please check this via an assertion in your code? After some quick googling it appears that there *might* be situations where a null-BaseDirectory might actually be a legal situation and we just never happened to come accross one. Therefor, I'd like to first figure out why you have a null-BaseDirectory and if you can simply rectify this sitatuation, before getting out the big guns.

It might also help if you could share your sample project with us via a public repository or as an attachment here.

Best regards, Michael
Message has been deleted

Tyhja Tchlstkov

unread,
Apr 16, 2014, 11:10:19 PM4/16/14
to re-moti...@googlegroups.com
Some formatting changes

On Wednesday, April 16, 2014 10:56:49 PM UTC+8, Tyhja Tchlstkov wrote:
Hi Micheal!

Thanks for replying! Actually, I am working with Unity3D which is really a platform to cross compile games. The latest version of unity currently uses MonoDevelop 4.0.1.

However it really is vanilla from the tutorial with some modifications to conform to the .NET 3.5 build. Monobehaviour is just Unity's base class for objects.

If you have unity, just open new empty project,
drag the code above and the mixin dlls into the project, drag MixinMono into an empty gameobject (create a new one or drag it into the default camera)
and then just run the project.

The printout shows a null as you would expect, which is the problem, as you have correctly surmised. Thanks! Please advice how to proceed.
MixInTesting.zip

Fabian Schmied

unread,
Apr 18, 2014, 2:52:03 AM4/18/14
to re-moti...@googlegroups.com
Tyhja,

As far as I know, you're the first one to use re-mix within a Unity
game, so there might be a few more stumbling stones waiting for you :)

About this one. To determine what mixins are applied to what classes,
re-mix needs to analyze the set of types used by your application.
(This is done by the
DeclarativeConfigurationBuilder.BuildDefaultConfiguration method on
the call stack.) By default, re-mix discovers these types by checking
all the assembly files in your application's base directory.

Now, in your scenario, there is no base directory. This is the first
time we've encountered this scenario; I've raised an issue in our
JIRA: https://www.re-motion.org/jira/browse/RM-6139. To solve your
issue, you need to replace the default type discovery mechanism with a
custom one. For this, simply implement ITypeDiscoveryService yourself
and ensure that it returns all the types that may have [Uses] or
[Extends] attributes applied to them. Then set an instance of it into
the ContextAwareTypeDiscoveryUtility.DefaultNonDesignModeService
property. This should avoid the code paths that use the base
directory.

Best regards,
Fabian
> --
> You received this message because you are subscribed to the Google Groups
> "re-motion Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to re-motion-use...@googlegroups.com.
> To post to this group, send email to re-moti...@googlegroups.com.
> Visit this group at http://groups.google.com/group/re-motion-users.
> For more options, visit https://groups.google.com/d/optout.

Tyhja Tchlstkov

unread,
Apr 19, 2014, 10:32:38 AM4/19/14
to re-moti...@googlegroups.com
Hi Fabian! Thanks for replying.

Well, its no problem. I'll have to work it out.
When you say "ensure that it returns all the types that may have [Uses] or [Extends] attributes applied", I am not too sure how to do that, I've been checking the source code since I saw your reply and it goes rather deep. Is there a file/class/function in particular i can look at that I can use as a reference or modify. Meanwhile, I'm still looking through. Thanks for your help :)

Michael Ketting

unread,
Apr 19, 2014, 12:55:34 PM4/19/14
to re-moti...@googlegroups.com
Hi Tyhja!

What Fabian referred to was that you need to take care that your custom type discovery services returns at least all the types where you have applied the UsesAttribute or the ExtendsAttribute. Otherwise, you would not have the complete mixin-configuration present. The easiest way to do that, is to explicitly provide all your own assemblies to the custom type discovery service during application start-up.

// code in application start-up
Remotion.Reflection.TypeDiscovery.DefaultNonDesignModeService = new MyTypeDiscoveryService(typeof (TypeFromDomainAssembly).Assembly, typeof (TypeFromOtherDomainAssembly).Assembly);

public class MyTypeDiscoveryService : ITypeDiscoverySerivce
{
 // See https://svn.re-motion.org/svn/Remotion/trunk/Remotion/Development/Core/UnitTesting/Reflection/TypeDiscovery/FixedTypeDiscoveryService.cs for an example

private Type[] _myTypes;
public
MyTypeDiscoveryService (Assembly[] myAssemblies)
{
_myTypes = myAssemblies.Select (a=>a.GetTypes()).ToArray();
}


public ICollection GetTypes (Type baseType, bool excludeGlobalTypes)     {       return _myTypes.Where (t => IncludeType (t, baseType, excludeGlobalTypes)).ToArray ();     }     private bool IncludeType (Type type, Type baseTypeFilter, bool excludeGlobalTypes)     {       return (baseTypeFilter == null || baseTypeFilter.IsAssignableFrom (type)) && (!excludeGlobalTypes || !type.Assembly.GlobalAssemblyCache);     }
}

Best regards, Michael

Tyhja Tchlstkov

unread,
Apr 20, 2014, 4:46:54 AM4/20/14
to re-moti...@googlegroups.com
Hi Micheal :)

You guys have been giving me great support :). I hope I'm not wearing you thin. I am not that familiar with assemblies, so I've been reading up so that I can set it in Remotion.Reflection.TypeDiscovery.DefaultNonDesignModeService as you've specified.

Does Mixin use dynamic assembly loading to achieve this effect? Or do you consider this static loading? I ask because it seems that iOS doesn't allow dynamic assembly loading (although there seems to be a reported workaround)

Also I have since successfully implemented as specified in your previous post, but have run into this error (I've attached the updated scripts):

NotSupportedException: Property UnderlyingSystemType is not supported. Use a replacement method from class TypeExtensions (e.g. IsTypePipeAssignableFrom) to avoid accessing the property.
Remotion.TypePipe.MutableReflection.Implementation.CustomType.get_UnderlyingSystemType ()
System.Type.Equals (System.Type o) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Type.cs:438)
System.Type.Equals (System.Object o) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Type.cs:432)
System.Object.Equals (System.Object objA, System.Object objB) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Object.cs:70)
Remotion.TypePipe.MutableReflection.TypeExtensions.IsTypePipeAssignableFrom (System.Type toType, System.Type fromType)
Remotion.TypePipe.Dlr.Dynamic.Utils.TypeUtils.AreReferenceAssignable (System.Type dest, System.Type src)
Remotion.TypePipe.Dlr.Dynamic.Utils.TypeUtils.IsValidInstanceType (System.Reflection.MemberInfo member, System.Type instanceType)
Remotion.TypePipe.Dlr.Ast.Expression.ValidateCallInstanceType (System.Type instanceType, System.Reflection.MethodInfo method)
Remotion.TypePipe.Dlr.Ast.Expression.ValidateStaticOrInstanceMethod (Remotion.TypePipe.Dlr.Ast.Expression instance, System.Reflection.MethodInfo method)
Remotion.TypePipe.Dlr.Ast.Expression.Call (Remotion.TypePipe.Dlr.Ast.Expression instance, System.Reflection.MethodInfo method, IEnumerable`1 arguments)
Remotion.TypePipe.MutableReflection.BodyBuilding.ConstructorBodyContextBase.CallConstructor (System.Reflection.ConstructorInfo constructor, ICollection`1 arguments)
Remotion.TypePipe.MutableReflection.BodyBuilding.ConstructorBodyContextBase.CallBaseConstructor (IEnumerable`1 arguments)
Remotion.TypePipe.MutableReflection.Implementation.MutableTypeFactory.<CopyConstructors>b__1 (Remotion.TypePipe.MutableReflection.BodyBuilding.ConstructorBodyCreationContext ctx)
Remotion.TypePipe.MutableReflection.Implementation.ProviderUtility.GetNonNullValue[Expression,ConstructorBodyCreationContext] (System.Func`2 provider, Remotion.TypePipe.MutableReflection.BodyBuilding.ConstructorBodyCreationContext context, System.String providerArgumentName)
Remotion.TypePipe.MutableReflection.BodyBuilding.BodyProviderUtility.GetTypedBody[ConstructorBodyCreationContext] (System.Type expectedType, System.Func`2 bodyProvider, Remotion.TypePipe.MutableReflection.BodyBuilding.ConstructorBodyCreationContext context)
Remotion.TypePipe.MutableReflection.Implementation.MemberFactory.ConstructorFactory.CreateConstructor (Remotion.TypePipe.MutableReflection.MutableType declaringType, MethodAttributes attributes, IEnumerable`1 parameters, System.Func`2 bodyProvider)
Remotion.TypePipe.MutableReflection.Implementation.MemberFactory.MutableMemberFactory.CreateConstructor (Remotion.TypePipe.MutableReflection.MutableType declaringType, MethodAttributes attributes, IEnumerable`1 parameters, System.Func`2 bodyProvider)
Remotion.TypePipe.MutableReflection.MutableType.AddConstructor (MethodAttributes attributes, IEnumerable`1 parameters, System.Func`2 bodyProvider)
Remotion.TypePipe.MutableReflection.Implementation.MutableTypeFactory+<CopyConstructors>d__4.MoveNext ()
System.Collections.Generic.List`1[Remotion.TypePipe.Dlr.Ast.Expression].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
System.Collections.Generic.List`1[Remotion.TypePipe.Dlr.Ast.Expression]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
System.Linq.Enumerable.ToList[Expression] (IEnumerable`1 source)
Remotion.TypePipe.MutableReflection.Implementation.ProxyTypeModificationTracker..ctor (Remotion.TypePipe.MutableReflection.MutableType proxyType, IEnumerable`1 constructorBodies)
Remotion.TypePipe.MutableReflection.Implementation.MutableTypeFactory.CreateProxy (System.Type baseType)
Remotion.TypePipe.TypeAssembly.Implementation.TypeAssembler.AssembleType (AssembledTypeID typeID, IDictionary`2 participantState, IMutableTypeBatchCodeGenerator codeGenerator)
Remotion.TypePipe.Implementation.Synchronization.SynchronizationPoint.GetOrGenerateType (Remotion.Utilities.ConcurrentDictionary`2 types, AssembledTypeID typeID, IDictionary`2 participantState, IMutableTypeBatchCodeGenerator mutableTypeBatchCodeGenerator)
Remotion.TypePipe.Implementation.Synchronization.SynchronizationPoint.GetOrGenerateConstructorCall (Remotion.Utilities.ConcurrentDictionary`2 constructorCalls, ConstructionKey constructionKey, Remotion.Utilities.ConcurrentDictionary`2 types, IDictionary`2 participantState, IMutableTypeBatchCodeGenerator mutableTypeBatchCodeGenerator)
Remotion.TypePipe.Caching.TypeCache.GetOrCreateConstructorCall (AssembledTypeID typeID, System.Type delegateType, Boolean allowNonPublic)
Remotion.TypePipe.Caching.TypeCache.GetOrCreateConstructorCall (System.Type requestedType, System.Type delegateType, Boolean allowNonPublic)
Remotion.TypePipe.Implementation.Pipeline.Create (System.Type requestedType, Remotion.Reflection.ParamList constructorArguments, Boolean allowNonPublicConstructor)
Remotion.Mixins.CodeGeneration.ObjectFactoryImplementation.CreateInstance (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create[StreetAddress] (Boolean allowNonPublicConstructors, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
EqualsShowCase.MixinImplementation.StreetAddress.NewObject (Int32 zipCode, System.String city, System.String street, System.String streetNumber) (at Assets/_Scripts/MixinTest/AddressTest.cs:97)
AddressMonoBehaviour.Update () (at Assets/_Scripts/MixinTest/AddressMonoBehaviour.cs:33)
MixinTest.zip

Fabian Schmied

unread,
Apr 21, 2014, 2:07:29 PM4/21/14
to re-moti...@googlegroups.com
Hi Tyhja,

re-mix uses Reflection.Emit to generate code at runtime. AFAIK, Mono
Touch on iOS cannot support this due to limitations of iOS.
While you could use the TypeMixer.exe tool to pregenerates most the
code needed by re-mix (and you could avoid dynamic loading by
statically referencing the assembly files generated by the TypeMixer),
re-mix will _still_ generate some code at runtime; for example, to
invoke constructors efficiently. I'm not sure if the APIs we use are
permitted on iOS, but I fear they are not.

If you still want to try; about the NotSupportedException. This is a
missing feature ("UnderlyingSystemType") in our underlying code
generation engine (called TypePipe) that _should_ not be required by
re-mix. It might be that you uncovered a bug in our code, but maybe
it's also a piece of code where Mono behaves differently than the .NET
base class library. Could you test whether your code works on an
ordinary .NET runtime?

We haven't ported the current versions of re-mix to Mono yet, but if
the reason is different behavior between Mono and .NET, you could try
build 1.13.209 (I believe) instead, which had a different engine which
might not cause the different behavior to emerge.

Best regards,
Fabian

Tyhja Tchlstkov

unread,
Apr 22, 2014, 12:54:46 AM4/22/14
to re-moti...@googlegroups.com
Hey Fabian,

Things appear bleak for me!
Compiling and running with MSVC (Express) 2013 and Monodevelop (Standalone) 4.2 works as expected.
It seems there could be some Unity implementation that could be the problem.

There isn't a 1.13.209, So I tried 210, and it gave the same error.
Trying 196 gave me this error: 
AssertionException: The internal method MethodInfo.GetParentDefinition has been removed. We need to patch this implementation.
Remotion.Utilities.Assertion.IsNotNull[MethodInfo] (System.Reflection.MethodInfo obj, System.String message, System.Object[] arguments)
Remotion.Utilities.Assertion.IsNotNull[MethodInfo] (System.Reflection.MethodInfo obj, System.String message)
Remotion.Utilities.AttributeRetrieval.InheritanceAwareCustomAttributeRetriever`1[System.Reflection.PropertyInfo].<.cctor>b__0 ()
Remotion.DoubleCheckedLockingContainer`1[System.Func`2[System.Reflection.MethodInfo,System.Reflection.MethodInfo]].get_Value ()
Remotion.Utilities.AttributeRetrieval.InheritanceAwareCustomAttributeRetriever`1[System.Reflection.PropertyInfo].GetBaseMethod (System.Reflection.MethodInfo methodInfo)
Remotion.Utilities.AttributeRetrieval.PropertyCustomAttributeRetriever.GetBaseMember (System.Reflection.PropertyInfo memberInfo)
Remotion.Utilities.AttributeRetrieval.InheritanceAwareCustomAttributeRetriever`1[TCustomAttributeProvider].GetCustomAttributes (.TCustomAttributeProvider memberInfo, System.Type attributeType, Boolean inherit)
Remotion.Utilities.AttributeUtility.GetCustomAttributes (System.Reflection.MemberInfo element, System.Type attributeType, Boolean inherit)
Remotion.Utilities.AttributeUtility.GetCustomAttribute (System.Reflection.MemberInfo element, System.Type attributeType, Boolean inherit)
Remotion.Mixins.Definitions.Building.OverridesAnalyzer`1+<Analyze>d__0[Remotion.Mixins.Definitions.PropertyDefinition].MoveNext ()
Remotion.Mixins.Definitions.Building.MixinDefinitionBuilder.AnalyzeOverrides (Remotion.Mixins.Definitions.MixinDefinition mixin)
Remotion.Mixins.Definitions.Building.MixinDefinitionBuilder.Apply (Remotion.Mixins.Context.MixinContext mixinContext, Int32 index)
Remotion.Mixins.Definitions.Building.TargetClassDefinitionBuilder.ApplyMixins (Remotion.Mixins.Definitions.TargetClassDefinition classDefinition, Remotion.Mixins.Context.ClassContext classContext)
Remotion.Mixins.Definitions.Building.TargetClassDefinitionBuilder.Build (Remotion.Mixins.Context.ClassContext classContext)
Remotion.Mixins.Definitions.TargetClassDefinitionFactory.CreateInternal (Remotion.Mixins.Context.ClassContext context)
Remotion.Mixins.Definitions.TargetClassDefinitionFactory.CreateAndValidate (Remotion.Mixins.Context.ClassContext context)
Remotion.Mixins.CodeGeneration.CodeGenerationCache.GenerateConcreteType (Remotion.Mixins.Context.ClassContext classContext)
Remotion.Collections.SimpleDataStore`2[Remotion.Mixins.Context.ClassContext,System.Type].GetOrCreateValue (Remotion.Mixins.Context.ClassContext key, System.Func`2 creator)
Remotion.Collections.Cache`2[Remotion.Mixins.Context.ClassContext,System.Type].GetOrCreateValue (Remotion.Mixins.Context.ClassContext key, System.Func`2 valueFactory)
Remotion.Mixins.CodeGeneration.CodeGenerationCache.GetOrCreateConcreteType (Remotion.Mixins.Context.ClassContext classContext)
Remotion.Mixins.CodeGeneration.CodeGenerationCache+<>c__DisplayClass2.<GetOrCreateConstructorLookupInfo>b__0 (Remotion.Mixins.CodeGeneration.CtorLookupInfoKey cc)
Remotion.Collections.SimpleDataStore`2[Remotion.Mixins.CodeGeneration.CodeGenerationCache+CtorLookupInfoKey,Remotion.Reflection.IConstructorLookupInfo].GetOrCreateValue (Remotion.Mixins.CodeGeneration.CtorLookupInfoKey key, System.Func`2 creator)
Remotion.Collections.Cache`2[Remotion.Mixins.CodeGeneration.CodeGenerationCache+CtorLookupInfoKey,Remotion.Reflection.IConstructorLookupInfo].GetOrCreateValue (Remotion.Mixins.CodeGeneration.CtorLookupInfoKey key, System.Func`2 valueFactory)
Remotion.Collections.LockingCacheDecorator`2[Remotion.Mixins.CodeGeneration.CodeGenerationCache+CtorLookupInfoKey,Remotion.Reflection.IConstructorLookupInfo].GetOrCreateValue (Remotion.Mixins.CodeGeneration.CtorLookupInfoKey key, System.Func`2 valueFactory)
Remotion.Mixins.CodeGeneration.CodeGenerationCache.GetOrCreateConstructorLookupInfo (Remotion.Mixins.Context.ClassContext classContext, Boolean allowNonPublic)
Remotion.Mixins.CodeGeneration.LockingCodeGenerationCacheDecorator.GetOrCreateConstructorLookupInfo (Remotion.Mixins.Context.ClassContext classContext, Boolean allowNonPublic)
Remotion.Mixins.CodeGeneration.ConcreteTypeBuilder.GetConstructorLookupInfo (Remotion.Mixins.Context.ClassContext classContext, Boolean allowNonPublic)
Remotion.Mixins.CodeGeneration.ObjectFactoryImplementation.CreateInstance (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create (Boolean allowNonPublicConstructors, System.Type targetOrConcreteType, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
Remotion.Mixins.ObjectFactory.Create[StreetAddress] (Boolean allowNonPublicConstructors, Remotion.Reflection.ParamList constructorParameters, System.Object[] preparedMixins)
EqualsShowCase.MixinImplementation.StreetAddress.NewObject (Int32 zipCode, System.String city, System.String street, System.String streetNumber) (at Assets/_Scripts/MixInText/AddressTest.cs:105)
AddressMonoBehaviour.Update () (at Assets/_Scripts/MixInText/AddressMonoBehaviour.cs:33)

Maybe it may shed some light on where it is going off ( or not ). 
Just one last check. I do this to load the assemblies-> types as outlined in an earlier post:

List<Type> typeList = new List<Type>();
foreach (System.Reflection.Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
if (assembly == null) {
Console.WriteLine ("Null Assembly");
continue;
}
Debug.Log(assembly);
typeList.AddRange (assembly.GetTypes());
}
ContextAwareTypeDiscoveryUtility.DefaultNonDesignModeService = 
new UnityTypeDiscoveryService (typeList);

Would this be correct? Perhaps I'm doing it wrong.

Michael Ketting

unread,
Apr 22, 2014, 2:25:53 AM4/22/14
to re-moti...@googlegroups.com
Hi Tyhja!

Regarding the error you are receiving in 1.13.210. We're depending on a .NET implementation detail for retrieving the base definition of a method. Apparently, this detail got fudged in the Mono-port. This and the Reflection.Emit stuff might actually be the real hurdles you're facing with Mixins on iOS.
If I remember correctly, 1.13.182 (https://remix.codeplex.com/releases/view/100268) should still use the non-reflection approach for the base-calls.

Anyhow, your assembly retrieval is syntactically correct, but it will only find assemblies that have already been loaded into the AppDomain at the time. That's where the original recommendation of explcitly naming types stems from.

Best regards, Michael

Tyhja Tchlstkov

unread,
Apr 22, 2014, 3:53:28 AM4/22/14
to re-moti...@googlegroups.com
Hey Michael!

Thanks for the 1-2 punch support from you guys XD
Following advice from both of you and eventually reverting to 1.13.182 has compiled and ran.

Just in case you are curious, Unity requires assemblies to be preloaded into the project thus retrieval is as such.

Everything seems to work, and the last hurdle is to cross compile for the iOS platform. There might be a need for further workarounds (I'll take note of the TypeMixer tool Fabian has mentioned in his previous reply, is there some sort of manual for it?) I'll report back if you guys are interested :)

Thanks for all the help guys!! :)

Michael Ketting

unread,
Apr 22, 2014, 10:24:00 AM4/22/14
to re-moti...@googlegroups.com
Hi Tyhja!


> Thanks for the 1-2 punch support from you guys
*G*


>Following advice from both of you and eventually reverting to 1.13.182 has compiled and ran.

Great to hear!


>Just in case you are curious, Unity requires assemblies to be preloaded into the project thus retrieval is as such.

Ah, yes. Thanks. In that case your way of getting the loaded assemblies will work just fine.

>I'll take note of the TypeMixer tool Fabian has mentioned in his previous reply, is there some sort of manual for it?

Only what's available via the command line help. (TypeMixer.exe /?) but that should be enough.It will analyze your bin directory and build an assembly that contains all the code needed for composing the mixins via proxy-types. You can then take that assembly and add it to your iOS deployment. Sadly, you will still run into the Reflection.Emit call Fabian mentioned when instantiating a mixed type. You could very likely work around those by replacing the ObjectFactoryImplementation and doing the same thing in there that we are doing, except use ctor MethodInfo.Invoke instead of Reflection.Emit.

Best regards, Michael

Tyhja Tchlstkov

unread,
May 10, 2014, 9:14:33 AM5/10/14
to re-moti...@googlegroups.com
Hi Guys!
Just an update. Thanks for all the support, but It is as you suspected. Emit is causing too much problems. There is an untested workaround to include the dlls dynamically instead of building it together but I've decided to discontinue. I am looking at other Inversion of Control frameworks that don't use emit, achieving most of mix-ins with some more work on our part. I guess I'll have to live with that.

Thank you again!

For those coming down the same path, there is no problem with 1.13.182 with Unity, Just if you are targeting the iOS platform. Other platforms work fine.
...

Michael Ketting

unread,
May 11, 2014, 8:27:01 AM5/11/14
to re-moti...@googlegroups.com
Hi Tyhja!

Thanks for letting us know :)

Best regards, Michael
...
Reply all
Reply to author
Forward
0 new messages