mcs-ICodeCompiler icon indicating copy to clipboard operation
mcs-ICodeCompiler copied to clipboard

error occur when using "dynamic" and "enum"

Open sericaer opened this issue 6 years ago • 1 comments

When I used the "dynamic" and "enum" as follow: class DynamicEnum { enum TEST { t1 }

    TEST _test;

    void Selected(dynamic param)
    {
        _test = param;
    }
}

I got an error without useful info: error : 10(18,14): native.DynamicEnum.Selected(dynamic) UnityEngine.Debug:Log(Object) CSharpCompiler.UnityLogTextWriter:Log(String) (at Assets/ThridParty/mcs_ICodeCompiler/UnityLogTextWriter.cs:19) CSharpCompiler.SourceCodeBundle:.ctor(ScriptBundleLoader, IEnumerable1) (at Assets/ThridParty/mcs_ICodeCompiler/ScriptBundleLoader.cs:227) CSharpCompiler.ScriptBundleLoader:LoadAndWatchSourceBundle(IEnumerable1) (at Assets/ThridParty/mcs_ICodeCompiler/ScriptBundleLoader.cs:41)

But if change the type of _test as "string", the error is disappeared

sericaer avatar Aug 03 '18 08:08 sericaer

Does your code work anywhere else ? How about Enum.Parse, usually you can not cast enum's directly, not in C# at least, Cheers,

thpetsen avatar Aug 04 '18 20:08 thpetsen