c# - dotnet-core could not found base Interface method -
i'm facing odd situation, if tried in vs 2015 navigates base symbol method without problem.even vs code omnisharp on ubuntu 16.04 has no problem navigate method. when run, throws odd exception. i'm %100 sure method there...
here dotpeek screenshot /yakari.tests/{outputdir}/yakari.dll
here structure:
public interface icacheprovider : idisposable { ..... void set(string key, object value, timespan expiresin, bool ismanagercall = false); ..... } public interface ilocalcacheprovider : icacheprovider { .... } public abstract class basecacheprovider : icacheprovider { ..... public abstract void set(string key, object value, timespan expiresin, bool ismanagercall = false); ..... } public class littlethunder : basecacheprovider, ilocalcacheprovider { ..... public override void set(string key, object value, timespan expiresin, bool ismanagercall = false) { .... } ..... }
when this:
public class sometestclass { ilocalcacheprovider _localcacheprovider; public sometestclass(ilocalcacheprovider localcacheprovider) { _localcacheprovider = localcacheprovider; } public void sometestmethod() { // below line throws: microsoft.csharp.runtimebinder.runtimebinderexception : 'yakari.ilocalcacheprovider' not contain definition 'set' _localcacheprovider.set("key", dynamic value, cachetime.fifteenminutes); } }
code taken https://github.com/titaniumsoft/yakari
note: can see same runtime error @ appveyor ci log
any ideas ? , regards...
the error you're getting in greateagle.cs:line 201 because you're making interface call typed "dynamic" passed parameter. if "dynamic" variable involved, interface dispatch becomes complicated, reflection-based, , slow.
so inmemorycacheitem.valueobject: why property typed "dynamic"? brief search in repo, might type "object" , avoid runtimebinder pains since you're casting everywhere anyway. or @ least cast object before pass set().
Comments
Post a Comment