-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
RegAsm
completely replaced by ServerRegistrationManager
#259
Conversation
…n no item is selected
…ager class instead of RegAsm. A new parameter is now available to force the use of RegAsm; just like before
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
==========================================
- Coverage 12.54% 12.43% -0.11%
==========================================
Files 86 86
Lines 3021 3047 +26
==========================================
Hits 379 379
- Misses 2642 2668 +26
Continue to review full report at Codecov.
|
Great job for sharing and improving on the issue :) I hope this will improve other registration issues as well. But I think it'd be wise to split this up as the changes have side effects (not only changes to replace RegAsm) as I see it. Also this thing here is bugging me, maybe you can explain?
Shouldn't this be reversed? The MEF approach for finding the Servers isn't that suitable for ever, though. If you use MEF you can only load servers from the same version of SharpShell used, as discussed in issue #217. Will test the changes at the weekend and report back if all my extensions (registration/unreg.) work as well. |
Sharp eyes @Countryen,
Well, the changes are all about the registration process with ServerManager.exe and ServerRegistrationManager.exe. Not much else is changed except maybe some minor tweaks to disable or enable a menu item and such; which was too annoying for me to ignore.
This isn't much of a problem with ServerRegistrationManager.exe as the SS version published with the tool is probably the same as the one the developer used in his/her extension. But then we probably should load the SharpShell library from the library's folder instead of publishing one with ServerRegistrationManager.exe. Especially because the NuGet packages are different and it is possible in theory for someone to use two different versions of NuGet packages. However, I see your point regarding ServerManager.exe especially now that I moved the code for finding classes in an assembly to the main library and others might use it inside their code. The problem, however, is not just the use of MEF, we can simply go for Reflection with ServerManager.exe should be able to load the extensions from registry instead of loading them from assembly files. This is a much bigger problem for now. Solving this, we can uninstall and unregister all version of SharpShell extensions and even manage other extensions. And for installation, maybe we should try to do what I suggested with ServerRegistrationManager.exe above with loading the right version of SharpShell published with the library we are trying to load. This, however, requires us to move the code regarding registration to a separate library so we can have access to these methods without actually loading the SharpShell library for ourselves. This is a big change and might break some older implementations, but I think a necessary one that can be published as part of major version 3.x.x not necessarily promising backwards compatibility for the custom registration codes. All that being said, the bigger problem, in my opinion, is the clarity of the code. It is hard to follow what happens. Namings are sometimes kind of hard to understand. In one class I saw three different namings for one thing, |
@falahati Thanks for changing that re/unregister thing around :) I now agree with you. Still need to test it, though.
I think that has to do with the difference between WindowsAPI and .NET / SharpShell / COM. It is hard to follow "along" but not if you only look at one part of the code (e.G. implement just a single interface). You don't need to know, that the DisplayName is actually the class name and the serverName most of the time, just use it as smth. to display. The code tends to use most expressions from msdn/windows source code in deeper classes and changes that for .NET developers for better understanding in higher classes, as I see it. And in WindowsAPI (and especially the shell) most things have multiple names all the time. I don't think it's necessary to change that at most places just to be equal. |
I agree with you on the points you mentioned regarding namings. However, the problem is not with an entity having different names throughout the library, but rather throughout a class. In my case, this being the I think we both can agree that in one class, we should'nt be able to see these and if necessary, the name changes should happen somewhere that makes it easy to understand. For example, an internal |
Had time to test it now. But I get bad results from testing the Sample servers. Maybe someone else got a clean environment to test the Samples? |
I am just curious about the type of errors you got. Maybe I can double check it. Now, to be honest, I tested the changes only with one my own servers (ContextMenu) but my environment wasn't especially clean either; same [but older versions of the] server was already installed and uninstalled multiple times. I just trusted that the I have a clean Win7 virtual machine tho; so I might be able to check it there. But knowing the exact problem and exact server to test would help a lot for sure. |
I have tested almost all of them (Except "AbcPreviewHandler.dll" and "WebSearchDeskBand.dll" for obvious reasons) using the new method and the old one (with and without "-regasm" argument) on a clean installation of Win7x64. Here are the results: General Problems:
|
BTW, didn't test with "srm.exe" as it isn't part of the official release as of version 2.2 as far as I know. Is it? Seems to be only available from the "SharpShellTools" NuGet package. |
Yes, I agree, that'd be the best to do.
I just used the built project's "Tools/ServerRegistrationManager" executable, renamed to SRM for shorter scripts. ServerRegistrationManger.exe is the successor of srm.exe (I think). |
Was checking the |
…experimental" argument added to use the build in installation process
Default installation provider changed back to "RegAsm". @dwmkerr, Hey Dave, any idea on these changes? |
Hi @falahati and everyone, thanks so much for the hard work on this! I like the approach, the reliance on It'll probably be next week before I can look at this in detail and continue to test in more scenarios, looking over all the comments so far, I hope that's OK! |
As a quick reminder to myself:
But frankly, manually creating the keys as done in this PR is pretty easy to do, and also would allow us to test more effectively by using some kind of mocked registry object. I'm going to merge this into a |
@dwmkerr, I suggest taking a look at #260 too since it can install and uninstall different versions and different bitness of extensions without using any third-party tool. In fact, it can even give you information about native extensions and uninstall them. #260 is essentially the next version of this PR. |
Closing as #323 contains the latest version of this code. |
Regarding #211,
These changes will update and replace every usage of
RegAsm
withServerRegistrationManager
.Also extends the
ServerRegistrationManager
class with a piece of code (refactored fromServerRegistrationApi.cs
) for server extraction from an assembly and some other minor changes and cleanups regarding this issue.Couldn't find any unit test and didn't bother to test sample servers as nothing really changed about them; however, registration and un-registration processes both with ServerRegistrationManager.exe and ServerManager.exe works in my environment.
In the case of ServerRegistrationManager.exe, it is still possible to force
RegAsm
by a new parameter named-regasm
, in case someone wants to use it for some reason. However, the default behaviour is to useServerRegistrationManager
class.