MasterDevs / ChromeDevTools

.NET library to interact with the Chrome Debugger
MIT License
135 stars 90 forks source link

Add support for .NET Core #9

Closed qmfrederik closed 8 years ago

qmfrederik commented 8 years ago

Hi @brewdente

This PR adds support for compiling and running ChromeDevTools on .NET Core.

There wasn't much that needed to be done; a change from WebClient to HttpClient and some changes to use the refactored reflection API.

Apart from that, I had to disable the ChromeSession and ChromeSessionFactory on .NET Core for now, because that uses WebSockets4Net and there isn't a .NET Core version available, yet. I had a look over at their GitHub repository and it seems a .NET Core version is being worked on, so that's a limitation that soon can be lifted.

I've updated the appveyor.yml file to also build using the .NET Core toolchain. It creates a single NuGet package targetting .NET 4.5 and .NET Core so I'm guessing that's the one you may want to be publishing to NuGet (would certainly help me!)

Cheers,

brewdente commented 8 years ago

How, via .NET Core, are you connecting to Chrome then? I feel like I'm either missing something obvious or is it just not available until there's a suitable WebSockets replacement?

Thanks for all the continued work on this! I'm digging the changes.

qmfrederik commented 8 years ago

In my case, I'm connecting over USB to Safari running on an iOS device. So I've rolled my own class which implements IChromeSession and takes care of sending/receiving the JSON messages to Safari, using a protocol that is similar to WebSockets but not really WebSockets.

It looks like .NET Core also has its own WebSockets client, which may be worth looking at, but at least it explains why I didn't require WebSocket4Net :)

Hope it clarifies!

brewdente commented 8 years ago

Totally makes sense. Yeah, I was just curious. Don't think it's a bad idea to throw in your USB Chrome Session into this repo. Up to you, though.