Closed devel0 closed 8 years ago
Hey devel0,
Can you provide the full exception text? I just resolved a very similar issue with the registration and unregistration of the dll.
You need to look into (your or the default) function CustomRegisterFunction
(Attribute: [CustomRegisterFunction]). It is called when you click "register" and you can easily "override" it to your needs (though the standard should work in every scenario). I for example had problems with security-exceptions writing to the registry...
You should launch a debugger process and see what's going on in there.
The function should be in the class SharpPreviewHandler
.
Hope that gives you a direction. Feel free to ask.
Greetings, Countryen.
Thanks for hints, meanwhile if useful, I post full exception text
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.IOException: The specified path is invalid.
at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)
at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck)
at Microsoft.Win32.RegistryKey.CreateSubKey(String subkey)
at SharpShell.ServerRegistration.ServerRegistrationManager.RegisterServerAssociations(Guid serverClsid, ServerType serverType, String serverName, IEnumerable`1 associationAttributes, RegistrationType registrationType) in c:\Repositories\GitHub\dwmkerr\sharpshell\SharpShell\SharpShell\ServerRegistration\ServerRegistrationManager.cs:line 412
at SharpShell.SharpShellServer.DoRegister(Type type, RegistrationType registrationType) in c:\Repositories\GitHub\dwmkerr\sharpshell\SharpShell\SharpShell\SharpShellServer.cs:line 76
at SharpShell.ServerRegistration.ServerRegistrationManager.RegisterServer(ISharpShellServer server, RegistrationType registrationType) in c:\Repositories\GitHub\dwmkerr\sharpshell\SharpShell\SharpShell\ServerRegistration\ServerRegistrationManager.cs:line 125
at ServerManager.ServerManagerForm.registerServerx64ToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1080.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
ServerManager
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.0
CodeBase: file:///C:/Users/loren/Documents/SoftCollect/MarkDownPreview/MarkdownPreview.0.3/ServerManager.exe
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1081.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1078.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SharpShell
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.0
CodeBase: file:///C:/Users/loren/Documents/SoftCollect/MarkDownPreview/MarkdownPreview.0.3/SharpShell.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1064.2 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.6.1064.2 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.ComponentModel.Composition
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1038.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ComponentModel.Composition/v4.0_4.0.0.0__b77a5c561934e089/System.ComponentModel.Composition.dll
----------------------------------------
MarkdownPreview
Assembly Version: 0.3.0.0
Win32 Version: 0.3.0.0
CodeBase: file:///C:/Users/loren/Documents/SoftCollect/MarkDownPreview/MarkdownPreview.0.3/MarkdownPreview.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Hey devel0,
I can reproduce the same error with my prototype now. It is your extension ".md" if you do the same registration with an extension with extension ".ico" (as in the sample) it should work.
Give that a try (just change the ".md" to ".ico" and rename your .md-file to a .ico-file).
Here is a picture why:
Find out the ClassName for the .md-extension, then...
Define the following key-value in the registry:
"HKCR\.md" > (Default) = <ClassName of .md-files>
Then registration should work.
Example for .ico:
"HKCR\.ico" > (Default) = icofile
I hope that works for you :)
It tries to register something in the ClassesRoot for the ".md".
But the "name" of the so called AssociationClass is "null" for .md . When I run the same with my prototype on ".ico" the associationClassName will be "icofile".
And I guess this is why:
It will return "icofile" for ".ico" because under "HKCR.ico" the (Default)-value is "icofile". According to my test, the "HKCR.md"-key indeed exists but is empty (no ValueCount) and I looked it up - my registry says the same (Default) = (Value not defined).
I tried defining (Default) for ".md" = "icofile" and now the registration (well ofc. only for ".ico"-files) works. Result:
[COMServerAssociation(AssociationType.ClassOfExtension, "icofile")]
instead of
[COMServerAssociation(AssociationType.ClassOfExtension, ".ico")]
As the second is only true if the registry is "correct".Cheers, Countryen
Very thanks for detailed explanation, I was able to make it work.
Hey devel0,
Great to hear. Coul you share the classname of the ".md" you added? (like "icofile").
Thanks in advance, Countryen
Effectively to make it work I simply removed the .md entry from the HKCR, I was tried with some combinations but I don't know the exact rule how to retrieve the classname for a file extension. Do you know how to do that ? thanks again.
Hey @devel0,
After deleting the key it did not throw an error but it does not work, does it? I mean does your preview show on .md-files now?
Sorry, no idea how to get the right class name for an extension. I googled it but found nothing. I would guess it beeing "mdfile" but you need to create a HKCR-key for it, too :/
It worked without the HKCR/.md key at all, the md preview works too with some issue on the preview: initially I need to move the GridSplitter to activate the view cause it appears black at all, but that issue should related to the MarkdownPreview handler.
This is a duplicate of #145. The issue is not fixed yet.
I experienced error installing a component
details here https://github.com/Atrejoe/MarkdownPreview/issues/2#issuecomment-235555406
Have you any ideas about what is that ? thanks