Closed madewokherd closed 2 years ago
Tried the import, and it turned out to be complicated. Late binding has hooks into several other parts of the VB.NET runtime. I still think it's worth doing in the future, given that the quality of mono-basic in general hasn't been very good, and dotnet core should be largely compatible (other than missing methods), but it needs more time than is worth putting in right now.
For now, implementing OptimisticSet is at least an improvement in behavior. The bug with CopyBack still exists, but it isn't any worse with this change.
While investigating this, I learned a little bit more about OptimisticSet. It seems
LateGet
is supposed to check for byref parameters and return that info to the caller via the CopyBack array. The caller will then only call LateSet*Complex for values that have been passed into byref arguments. So in most cases, LateSet*Complex shouldn't be called at all, and OptimisticSet is just working around an earlier error.Implementing CopyBack is tricky because we don't get that information from InvokeMember which is currently being used. I think that only LateBinder has this information.
There are also likely other subtleties we're missing. It might be better to import this from .NET Core if we can.