IL2CPP MethodBase.GetCurrentMethod() unsupported

I am getting the following exception:

NotSupportedException: Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection/MethodBase.cpp(41) : Unsupported internal call for IL2CPP:MethodBase::GetCurrentMethod - “This icall is not supported by il2cpp.”

We’re using this to initialize our loggers (using log4net) so that each class has a logger with the name of that class. The log4net docs suggest using this solution, so it can easily be copy-pasted into new classes without having to explicitly specify the class name:

static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

Before I refactor all 200+ places this is being used, I would like to know if it will be supported in the near future. Does this error mean IL2CPP is not planning to support this call, or is it just not yet implemented?

Out of curiosity, have you tested it on iOS? This may actually be an AOT limitation, not necessarily IL2CPP

This works fine in 4.X and 5.0 in mono mode. Only fails (at runtime) with IL2CPP enabled.

Hi,

I believe this is a remnant from times of when we didn’t yet support walking the managed stack. I also think it’s mistakenly writes not supported, while it should be not implemented. Could you report a bug so it doesn’t get lost?

Bug filed, 664125

Thanks.