Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: .NET Core Support #331

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

wip: .NET Core Support #331

wants to merge 5 commits into from

Conversation

dwmkerr
Copy link
Owner

@dwmkerr dwmkerr commented Jul 12, 2020

This is now partially working. To show it in action:

  1. Open the solution, build all of the code.
  2. Manually install the .NET Core version of the CountLinesExtension with regsvr32.
  3. Now load the CountLinesExtension in the server manager.
  4. Register the extension as x64.
  5. You will be able to run the extension by right clicking on any txt file...
  6. ...however, any subsequent run will crash the host process (i.e. explorer in most cases)

The exception is:

image

And I have no idea why. So far testing with a side-by-side manifest has not fixed the issue. Note that the extension is debuggable as expected from the ServerManager.

Current issues:

  • Internals are not visible to tests/SRM, which breaks the build
  • Support registration of .NET Core COM servers; check if the assembly is .NET Core, check for the presences of the*.comhost.dll file; register the comhost; throw if anything looks weird
  • README needs updating with compatibility matrix
  • Extensions built with .NET Core need testing
  • Currently the 'count lines' context menu extension has been setup to use .NET Core 3.1 and doesn't work, so some digging will be needed here.
  • We can clean up the cludgy 'post build' steps to use targets like this https://github.com/dotnet/samples/blob/master/core/extensions/COMServerDemo/COMServer/COMServer.csproj#L47
  • document the differences between registration of .NET Framework and .NET Core COM servers (there are screenshots in the docs)
  • reference the .NET Core COM Hosting guide here: https://docs.microsoft.com/en-us/dotnet/core/native-interop/expose-components-to-com
  • Extract all server registration and extension registration into its own assembly - all it needs to do is basically write to the registry. This library could then be consumed by a CLI, desktop app or other users. It should be smart enough to be able to identify a .NET Core server vs a Framework server. In the future, it could also be used to enumerate extensions, which might be interesting. It would also then be easier to write unit tests which assert that the appropriate registry entries are written.
  • This like ClassRegistration and ClassRegistration could all be pulled into the separate registration library, at the moment they are only used by the half baked GUI that I'd been working on to manage shell extensions.
  • Eliminate MEF and essentially just load and register servers via pseudo Duck Typing, if there's something which implements ISharpShellExtension or whatever then we assume we can try and register it. This will fix the requirements that the server manager needs to be compiled with the same version of SharpShell as the server itself.
  • We will only be able to register .NET Core Shell Extensions using the tooling from version 3.0 onwards - because only that version of the tooling can correctly identify if an assembly is a .NET Core assembly.
  • The registration manager project (which will be extracted) will need to have tests for both the .NET Framework and .NET Core, because the code is different for the different platforms (see MetadataReader)
  • docs: .NET Core extensions will not support self-contained deployments (check the proper nomenclature)

Server Manager

  • Rewrite in WPF?
  • Elevate permissions only as needed?

Closes #252

@guardrails
Copy link
Contributor

guardrails bot commented Jul 12, 2020

⚠️ We detected security issues in this pull request:

Hard-Coded Secrets (1)

<InternalsVisibleTo Include="ServerRegistrationManager" Key="0024000004800000940000000602000000240000525341310004000001000100a5981b638f37c9bdd36af30b4a7c34b7e8fce33c5e424f37538f7dbd4e108c12909a2efcc4a2eb6dd4ef509cb53443a07f90504a7c8ec1a51813bd6696d21ab20d68d823ef8e840a3c4cdcf95c21122e153b389566c23c20f8e58fa4d15c810538443a303e6049d3ce9c8e589bb2277fab465f8bb2cfd2e4740688bc8f5b95e7" />

More info on how to fix Hard-Coded Secrets in General.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@dwmkerr dwmkerr force-pushed the feat/dotnet-core-support branch from e049b36 to faeea08 Compare July 13, 2020 02:43
@guardrails
Copy link
Contributor

guardrails bot commented Jul 13, 2020

All previously detected findings have been fixed. Good job! 👍🎉

We will keep this comment up-to-date as you go along and notify you of any security issues that we identify.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@dwmkerr dwmkerr force-pushed the feat/dotnet-core-support branch from faeea08 to 63aeca6 Compare July 13, 2020 03:03
@guardrails
Copy link
Contributor

guardrails bot commented Jul 13, 2020

⚠️ We detected security issues in this pull request:

Hard-Coded Secrets (1)

<InternalsVisibleTo Include="ServerRegistrationManager" Key="0024000004800000940000000602000000240000525341310004000001000100a5981b638f37c9bdd36af30b4a7c34b7e8fce33c5e424f37538f7dbd4e108c12909a2efcc4a2eb6dd4ef509cb53443a07f90504a7c8ec1a51813bd6696d21ab20d68d823ef8e840a3c4cdcf95c21122e153b389566c23c20f8e58fa4d15c810538443a303e6049d3ce9c8e589bb2277fab465f8bb2cfd2e4740688bc8f5b95e7" />

More info on how to fix Hard-Coded Secrets in General.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

@dwmkerr dwmkerr force-pushed the feat/dotnet-core-support branch 3 times, most recently from 374dbbb to 558283a Compare July 14, 2020 13:25
This is still work in progress. Current issues:

- [ ] Internals are not visible to tests/SRM, which breaks the build
- [ ] README needs updating with compatibility matrix
- [ ] Extensions built with .NET Core need testing
@dwmkerr dwmkerr force-pushed the feat/dotnet-core-support branch from 558283a to d67fd00 Compare July 16, 2020 14:43
@dwmkerr dwmkerr added good first issue help wanted registration-and-installation related to registration and installation of sharpshell server labels Jul 16, 2020
@dwmkerr dwmkerr self-assigned this Jul 16, 2020
@wangfu91
Copy link

First of all, great work! thanks for the library.

...however, any subsequent run will crash the host process (i.e. explorer in most cases)

I checked out this PR locally, played with the CountLinesExtension sample, can't reproduce this issue anymore.

It seems to be the same issue with dotnet/runtime#38950, which has been fixed recently and backported to .net core 3.1.x: dotnet/coreclr#28073

@DarkCreekWay
Copy link
Contributor

Verified @wangfu91's findings. The crash does not happen with sdk 3.1.8 and beyond.

@DarkCreekWay
Copy link
Contributor

@dwmkerr Would you mind to add an .editorconfig file to the solution ? This would make it way more easy to contribute.

@Mik4sa
Copy link

Mik4sa commented Mar 23, 2021

Do you have any timeframe for when this should be done?
And what is still missing here?

@Repiteo
Copy link
Contributor

Repiteo commented Sep 8, 2021

Echoing the previous comment; very excited to see this merged to the main branch!

dwmkerr and others added 3 commits October 10, 2022 21:34
• Calling to statically-placed "vswhere.exe" detects MSBuild automatically
• "t:Restore" allows immediate building from this script, without first needing to launch visual studio & reimport missing packages
• $args handled as string array, can now be passed directly to command without needing to duplicate content (not strictly needed with the new syntax, but the old ampersand call would've gotten use out of it)
@luky92
Copy link

luky92 commented Aug 28, 2023

Is this project dead or still active?

@dwmkerr
Copy link
Owner Author

dwmkerr commented Aug 28, 2023

I'm looking for others who can continue it if possible - it's not 'officially' abandoned but I have super limited capacity

@kocburak
Copy link

kocburak commented Oct 22, 2023

Sorry to hear that. I am trying to create a Encryption tool for folders and want to browse it's inside (like zip) without first exporting to persistant storage. Is there an alternative library for this? I dont want to program a whole File Explorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue help wanted registration-and-installation related to registration and installation of sharpshell server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Managed Shell Extensions with .NET Core & Side-by-Side Execution via manifests
7 participants