RickStrahl / wwDotnetBridge

.NET Interop for Visual FoxPro made easy
http://west-wind.com/wwDotnetBridge.aspx
MIT License
74 stars 35 forks source link

Use .NET 4 CLR hosting API #18

Closed breyed closed 1 year ago

breyed commented 6 years ago

This PR contains the remaining changes not applied from the previous PR, and a couple things I noticed when merging. The biggest fish is to use .NET 4 CLR hosting API; hence the title of the PR, but there are several other enhancements as well.

The PR is based on RickStrahl/wwDotnetBridge/master, so it seems like it should be easy to merge, but then again, GitHub says "Can’t automatically merge." I don't know if that's because of the size of the diff or some other reason. Hopefully, it will be painless. 🤞

This PR does not contain high priority features or fixes, but rather more subtle improvements, many of which were byproducts of my debugging efforts, but IMHO still well worth incorporating.

Enhancements fall into these categories:

wwDotnetBridge.prg

ClrHost

DotNetBridge

Tests

breyed commented 5 years ago

We ran into some intermittent problems with the async approach to subscribing to events. After looking at how the async code is implemented, I saw that we didn't need to use the async subsystem, but could instead, call back into the event dispatcher directly. This removed the event wait loop as fixed the reliability problem.

breyed commented 5 years ago

I merged your latest commits into breyed/master so that you can pull in the remaining changes without conflicts. The primary update in my branch since your latest release is that events are now raised directly, rather than via InvokeMethodAsync. This avoids timing issues when unsubscribing.

My branch also contains various other minor changes that I'd made along the way. Let me know if any don't seem suitable for inclusion. I want to get to a point where my branch matches yours so that it's easier to make clear, narrow changes.

If you use GitHub for diffing, wwDotnetBridge.PRG might be annoying to look at, since one of the minor changes was fixing the mix of tabs and spaces to just spaces (which seems to be what you had intended). Fortunately, GitHub has a secret URL suffix ?w=1 to ignore whitespace.