Closed ElektroStudios closed 6 years ago
Hey ElektroStudios,
I just tried this out as you described, but the problem doesn't happen for me.
VS17CE, Windows 10, x64, Sample Server (FileTimesPropertySheet), just compiled (with the NativeBridge) and registered with ServerManager.exe for both x86 and x64 (with registration).
I opened the property sheet "File Times" on 10 files and waited for about 10 minutes - they don't disappear on my machine.
Maybe there is something else on your PC that's causing that, or maybe I did something different? (I had to update the VS15 NativeBridge project to VS17, first)
Hi Countryen, thanks for answer. Did you opened those sheets at same time, I mean, the 10 "File times" sheets were remained opened for around 10 minutes?, so strange then, If I do the same I end with some sheets in blank (the controls of the sheet disappear after opening one more new sheet, few seconds later).
I will try to register the shell-extension in a fresh, unmodified Windows 10 (in a virtual machine) to see whether I can reproduce it, to discard whether its a problem of my current OS configuration or third party apps or something else.
Please stay tuned, maybe in a couple of hours or tomorrow I comment about what I experienced. I also will try to give better explained steps to reproduce the issue, if I can.
Thanks again.
Did you opened those sheets at same time, I mean, the 10 "File times" sheets were remained opened for around 10 minutes?
Yes exactly that, I also tried to "Touch" the files or swap between the sheets after the waiting time, but nothing changed.
I'm sorry for being late in answering, but I'm facing a big barrier that has not allowed me to test anything yet: https://github.com/dwmkerr/sharpshell/issues/179
I start to hating this library, really, it seems buggy as hell and it only makes lose my time for hours and days to try develop, in a consistent way, what should be a simple property sheet with a simple listview on it and anything more. The contents of the property sheet disappear without reason, or the property sheet just never appear (as I reported in the issue above, https://github.com/dwmkerr/sharpshell/issues/179 )
Hey read that. I probably know why and the solution. Will write when I am at home. You probably need the SharpshellNativeBridge. W/o it won't create the sheet. Look in the base class, it loggs the problem, too.
Hey again, now at home. Did you check for the bridge? I had a very similar issue when I tried to check for your issue #177.
TLDR: I had the same issue, no Property Sheets showed, though the Server registered completely. I then build the SharpShellNativeBridge project (updated to v141) and put that output (/bin) next to my Server-DLL-file. Then re-registered and restartet explorer.exe - now it works.
Background Info I checked out the complete sharpshell-repo (svn). Then I created a new project, referenced the sharpshell project. Copied the stuff from the sample "FileTimesPropertySheet"-project to my files and created the project. First issue: Had to remove the build-post-scripts. Then it worked, I could register with srm.exe or ServerRegistrationManager.exe and even with the ServerManager.exe.
But - as for you - the PropertySheet never showed. Not even the extra page in the "Properties"-Window of any file. But I searched the registry, the keys are well set. I then tried to only support ".pdf" - keys well set in registry - still no luck here.
What I did to find my solution
I added some simple logging one-liner at the beginning of my class' methods (CanShowSheet + CreatePages) like:
System.IO.File.AppendAllLines(@"D:\PropertySheet.log", new string[] { "CanShowSheet" + string.Join(" ", SelectedItemPaths) });
I noticed in the log file, that only "CanShowSheet" was logged - so the server was fine and running, but still no sheet.
I then added same logging into the SharpShell project into the SharpPropertySheet abstract base class for to further trace the issue.
I added logging for the constructor (SharpPropertySheet) and IShellPropSheetExt.AddPages.
I recompiled everything and installed/registered (via ServerManager.exe) from anew. Logging result:
SharpPropertySheet
IShellPropSheetExt.AddPages
CanShowSheetD:\PropertySheet.log
I added more and more logging steps and found following lines inside SharpPropertySheet class, that the program ran into.
// Create the bridge.
var bridge = new NativeBridge.NativeBridge();
// Initialise it.
if (bridge.Initialise() == false)
{
Logging.Error("Failed to initialise the NativeBridge.", null);
return 0;
}
Solution I then started the solution for sharpshell, VS prompted me to a: install VS140 or b: update the project "SharpShellNativeBridge" to v141 - I did the latter. Then I compiled the project (again, had to remove post-build-scripts). I then moved the output files from the /bin folder to the same folder of my Shell-Server (my .dll-file) and re-registered, restarted explorer and finally, the Property Sheets showed.
P.S. (This is intended to be so long as there is no indication that you actually need the NativeBridge (sometimes?))
(I know that the "Logging.Error" would do the same as my logging, but I don't know how to use it, doesn't matter in this case.)
Off topic
I start to hating this library, really, it seems buggy as hell and it only makes lose my time for hours and days to try develop, in a consistent way, what should be a simple property sheet with a simple listview on it and anything more.
Same here, but only because A: it is not well documented B: the "getting started" could be better (also part of documentation) C: so many opened issues
But, for me, it's still the best option to manage your needs in Shell-Development with C#. I doubt it's really the frameworks fault, but it's hard for one person (or even a small team) to figure out all and stay up to date with Shell/Windows.
Also Shell-Programming seems to be a "kind-of" not so easy topic, as much documentation is either obsolete or hard to grasp at all. Do you know an alternative?
After spending some time (and documenting my own nuts and bits to get everything smooth) I manage all my Shell needs with this project/framework/library (except the Info-Bar-Extension I originally wanted and still don't have any clue how to get it to work) - this and QTTabBar
First of all I want to thank you the time you had put in your debugging session and also for sharing your conclusions.
"But, for me, it's still the best option to manage your needs in Shell-Development with C#. Do you know an alternative?"
The only reason why SharpShell is the best, its because is the only managed solution to do these things under .NET, at least as far as I know. Does not seem to exist any kind of free neither commercial product competence to be able compare what can do other product compared to SharpShell.
The author of this library is only one person, and you seen how huge the source-code it is, that is an admirable work, but the more instructions and functionalities he added, only one person focusing to cover all kind of features, the more code complexity at the end that could trigger more unknown/undetected and strange bugs with no easy solution for us...
"I then build the SharpShellNativeBridge project (updated to v141) and put that output (/bin) next to my Server-DLL-file. Then re-registered and restartet explorer.exe - now it works."
Excuse me, I do not doubt that this has worked for you, but this does not have sense for me. How this could explain that I can register the same .dll in my main OS (which is the same Windows 10 build) and see the property sheet without copying the nativebridge.dll into the bin folder?.
Anyway I followed your steps, see, I put these files in the same directory:
I then registered with the ServerManager, restarted explorer, but the property sheet tab still not shown in the virtualized OS. :(
Is SharpShellNativeBridge32.dll and SharpShellNativeBridge64.dll the right files I need to put there?.
I've discovered SharpShell like 3 or 4 years ago in codeproject.com, I used to develop a shell extension that adds context menu items, the library was very bugged, incapable of adding an icon to the context menu item.
Now, days ago, I wanted to use SharpShell to develop a property sheet that will give me info of interest for .NET assemblies, see:
However, it seem I will never be able to finish this project and publish it in GitHub due all the strange problems I'm having with sharpShell. The thing that the controls of the property sheet disappear for no reason... oh boy, how many headaches gives me that losing time in a eternal trial and error test, because when that happens no exception is triggered, so I don't know what to try to solve it, and that in case of I could solve it... if it is not an issue about SharpShell itself.
Maybe do you know at which part of the SharpShell source-code I could add some logging logic to try discover why reason the controls of my property sheet (the listview) dissapear when I open many property sheets?.
I didn't find any dll, I just put these files next to my Server dll (didn't expect much to happen actually).
(how did you get dlls?)
This is the folder I copied from: %sharpshell_repo%\trunk\SharpShell\SharpShellNativeBridge\x64\Debug
I don't know why that happens, I just know it did happen for me and not the first time. Try out the logging and see if you run into the "Logging.Error("Failed to initialise the NativeBridge.", null);". Maybe it depends on which PC you build the NativeBridge?
I tried something. I tried to remove the NativeBridge again. I removed the files from the folder my Server is in. I also renamed all the paths to the projects, and re-registered. The Property Sheet still shows. I guess it is registered somewhere, I read in the code that it is loaded and found "automatically" but not exactly where - that's what I am looking for now.
Will try the same today as you, deploying my (now magically working) server on my other W10 machine - I doubt it works.
@Countryen thanks, I will try what you suggested in later.
Now I'm testing the most important issue for me which is the controls disappearing, and I think I found a way that you can reproduce it. I can't test it in a VM you know why, but I can reproduce it in my main OS.
Steps:
At this point, when opening multiple property sheets you should see that the very first opened property sheet disappear, it turns empty. And the rest of opened property sheets maybe too, this seems random.
Please, could you test it and say me whether you can reproduce my problem?.
This is the original code of FileTimesPropertyPage.Designer.cs:
namespace FileTimesPropertySheet
{
partial class FileTimesPropertyPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.dateTimePickerCreatedDate = new System.Windows.Forms.DateTimePicker();
this.dateTimePickerCreatedTime = new System.Windows.Forms.DateTimePicker();
this.dateTimePickerModifiedTime = new System.Windows.Forms.DateTimePicker();
this.dateTimePickerModifiedDate = new System.Windows.Forms.DateTimePicker();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePickerAccessedTime = new System.Windows.Forms.DateTimePicker();
this.dateTimePickerAccessedDate = new System.Windows.Forms.DateTimePicker();
this.label3 = new System.Windows.Forms.Label();
this.buttonTouch = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Time Created";
//
// dateTimePickerCreatedDate
//
this.dateTimePickerCreatedDate.Location = new System.Drawing.Point(20, 48);
this.dateTimePickerCreatedDate.Name = "dateTimePickerCreatedDate";
this.dateTimePickerCreatedDate.Size = new System.Drawing.Size(141, 20);
this.dateTimePickerCreatedDate.TabIndex = 1;
this.dateTimePickerCreatedDate.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// dateTimePickerCreatedTime
//
this.dateTimePickerCreatedTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
this.dateTimePickerCreatedTime.Location = new System.Drawing.Point(167, 48);
this.dateTimePickerCreatedTime.Name = "dateTimePickerCreatedTime";
this.dateTimePickerCreatedTime.ShowUpDown = true;
this.dateTimePickerCreatedTime.Size = new System.Drawing.Size(75, 20);
this.dateTimePickerCreatedTime.TabIndex = 2;
this.dateTimePickerCreatedTime.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// dateTimePickerModifiedTime
//
this.dateTimePickerModifiedTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
this.dateTimePickerModifiedTime.Location = new System.Drawing.Point(167, 112);
this.dateTimePickerModifiedTime.Name = "dateTimePickerModifiedTime";
this.dateTimePickerModifiedTime.ShowUpDown = true;
this.dateTimePickerModifiedTime.Size = new System.Drawing.Size(75, 20);
this.dateTimePickerModifiedTime.TabIndex = 5;
this.dateTimePickerModifiedTime.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// dateTimePickerModifiedDate
//
this.dateTimePickerModifiedDate.Location = new System.Drawing.Point(20, 112);
this.dateTimePickerModifiedDate.Name = "dateTimePickerModifiedDate";
this.dateTimePickerModifiedDate.Size = new System.Drawing.Size(141, 20);
this.dateTimePickerModifiedDate.TabIndex = 4;
this.dateTimePickerModifiedDate.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(17, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(73, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Time Modified";
//
// dateTimePickerAccessedTime
//
this.dateTimePickerAccessedTime.Format = System.Windows.Forms.DateTimePickerFormat.Time;
this.dateTimePickerAccessedTime.Location = new System.Drawing.Point(167, 178);
this.dateTimePickerAccessedTime.Name = "dateTimePickerAccessedTime";
this.dateTimePickerAccessedTime.ShowUpDown = true;
this.dateTimePickerAccessedTime.Size = new System.Drawing.Size(75, 20);
this.dateTimePickerAccessedTime.TabIndex = 8;
this.dateTimePickerAccessedTime.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// dateTimePickerAccessedDate
//
this.dateTimePickerAccessedDate.Location = new System.Drawing.Point(20, 178);
this.dateTimePickerAccessedDate.Name = "dateTimePickerAccessedDate";
this.dateTimePickerAccessedDate.Size = new System.Drawing.Size(141, 20);
this.dateTimePickerAccessedDate.TabIndex = 7;
this.dateTimePickerAccessedDate.ValueChanged += new System.EventHandler(this.OnAnyDateTimeControlValueChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(17, 151);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Time Accessed";
//
// buttonTouch
//
this.buttonTouch.Location = new System.Drawing.Point(20, 215);
this.buttonTouch.Name = "buttonTouch";
this.buttonTouch.Size = new System.Drawing.Size(75, 20);
this.buttonTouch.TabIndex = 9;
this.buttonTouch.Text = "Touch";
this.buttonTouch.UseVisualStyleBackColor = true;
this.buttonTouch.Click += new System.EventHandler(this.buttonTouch_Click);
//
// FileTimesPropertyPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.buttonTouch);
this.Controls.Add(this.dateTimePickerAccessedTime);
this.Controls.Add(this.dateTimePickerAccessedDate);
this.Controls.Add(this.label3);
this.Controls.Add(this.dateTimePickerModifiedTime);
this.Controls.Add(this.dateTimePickerModifiedDate);
this.Controls.Add(this.label2);
this.Controls.Add(this.dateTimePickerCreatedTime);
this.Controls.Add(this.dateTimePickerCreatedDate);
this.Controls.Add(this.label1);
this.Name = "FileTimesPropertyPage";
this.Size = new System.Drawing.Size(339, 422);
this.Load += new System.EventHandler(this.FileTimesPropertyPage_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DateTimePicker dateTimePickerCreatedDate;
private System.Windows.Forms.DateTimePicker dateTimePickerCreatedTime;
private System.Windows.Forms.DateTimePicker dateTimePickerModifiedTime;
private System.Windows.Forms.DateTimePicker dateTimePickerModifiedDate;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DateTimePicker dateTimePickerAccessedTime;
private System.Windows.Forms.DateTimePicker dateTimePickerAccessedDate;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button buttonTouch;
}
}
And this is the resulting code after removing all controls except the button:
namespace FileTimesPropertySheet
{
partial class FileTimesPropertyPage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonTouch = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// buttonTouch
//
this.buttonTouch.Location = new System.Drawing.Point(20, 215);
this.buttonTouch.Name = "buttonTouch";
this.buttonTouch.Size = new System.Drawing.Size(75, 20);
this.buttonTouch.TabIndex = 9;
this.buttonTouch.Text = "Touch";
this.buttonTouch.UseVisualStyleBackColor = true;
this.buttonTouch.Click += new System.EventHandler(this.buttonTouch_Click);
//
// FileTimesPropertyPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.buttonTouch);
this.Name = "FileTimesPropertyPage";
this.Size = new System.Drawing.Size(339, 422);
this.Load += new System.EventHandler(this.FileTimesPropertyPage_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button buttonTouch;
}
}
The only differences between those codes are:
And maybe you could think that if those are the only changes, then the missing call to this.PerformLayout() is probably what cause the controls disappear.
...It is not. I tested it. After changing the TadIndex to 0, and adding the missing this.PerformLayout() (or what is the same: this.ResumeLayout(performLayout:true) ) the property sheet still disapear after opening multiple of them.
The strange thing is that this problem of a property sheet disappear is only reproducible when you do any kind of modification in the UI, like for example removing a control as I specified in the steps. I mean, I was wrong the first time, If I compile the FileTimesPropertySheet.csproj project without modifying the UI, then it works all fine, the property sheet never disappear; to reproduce the problem first is needed to do any kind of change in the UI that rewrites the auto-generated code in the FileTimesPropertyPage.Designer.cs file.
So strange thing.
This issue sounds very similar to my issue experienced with many property sheets - #88 as well as #124
Well
The strange thing is that this problem of a property sheet disappear is only reproducible when you do any kind of modification in the UI, like for example removing a control as I specified in the steps. If I compile the FileTimesPropertySheet.csproj project without modifying the UI, then it works all fine, the property sheet never disappear.
Is kind of important, will test that out first.
Thanks for the video. I try to get my Server working again. Just noticed that all my attempts to register/install the server will fail, if I don't start Server Manager in Admin mode (Elevated Mode). Even though, the Server Manager says, that everything is registered and installed fine.
I noticed, that the background changes, too.
(Btw, nice desktop ;) and nice "work" music :D)
Hey, Did 1:1 what you did - no change in result. The Property Sheets don't vanish on my PC. See attached gif. for details. Did this around 14:20 - still showing all of the property sheets.
@Countryen what OS version are you using?, just to know whether you ran it in Windows 10 x64 as I did.
PS C:\Users\...> systeminfo | more
Hostname: C0PCS
Betriebssystemname: Microsoft Windows 10 Home
Betriebssystemversion: 10.0.17134 Nicht zutreffend Build 17134
Betriebssystemhersteller: Microsoft Corporation
Betriebssystemkonfiguration: Eigenständige Arbeitsstation
Betriebssystem-Buildtyp: Multiprocessor Free
Registrierter Benutzer: Windows User
Registrierte Organisation:
Produkt-ID: 00325-95800-00000-*****
Ursprüngliches Installationsdatum: 03.05.2018, 18:34:53
Systemstartzeit: 26.08.2018, 00:47:41
Systemhersteller: ECT
Systemmodell: FB 24133 ONE GameStar PC Ultra
Systemtyp: x64-based PC
Prozessor(en): 1 Prozessor(en) installiert.
[01]: Intel64 Family 6 Model 158 Stepping 10 GenuineIntel ~3201 MHz
BIOS-Version: American Megatrends Inc. 0430, 01.11.2017
Windows-Verzeichnis: C:\WINDOWS
System-Verzeichnis: C:\WINDOWS\system32
Startgerät: \Device\HarddiskVolume1
Systemgebietsschema: de;Deutsch (Deutschland)
Eingabegebietsschema: de;Deutsch (Deutschland)
Zeitzone: (UTC+01:00) Brüssel, Kopenhagen, Madrid, Paris
Gesamter physischer Speicher: 16.320 MB
Verfügbarer physischer Speicher: 8.383 MB
Virtueller Arbeitsspeicher: Maximale Größe: 18.752 MB
Virtueller Arbeitsspeicher: Verfügbar: 5.369 MB
Virtueller Arbeitsspeicher: Zurzeit verwendet: 13.383 MB
Auslagerungsdateipfad(e): C:\pagefile.sys
Domäne: WORKGROUP
Anmeldeserver: \\C0PCS
Hotfix(es): 4 Hotfix(e) installiert.
[01]: KB4338832
[02]: KB4343669
[03]: KB4343902
[04]: KB4343909
Netzwerkkarte(n): 3 Netzwerkadapter installiert.
[01]: TAP-Win32 Adapter V9 (Tunngle)
Verbindungsname: Tunngle
Status: Medien getrennt
[02]: Intel(R) Ethernet Connection (2) I219-V
Verbindungsname: Ethernet
(omitted)
[03]: LogMeIn Hamachi Virtual Ethernet Adapter
Verbindungsname: Hamachi
(omitted)
Anforderungen für Hyper-V: Erweiterungen für den VM-Überwachungsmodus: Ja
Virtualisierung in Firmware aktiviert: Ja
Adressübersetzung der zweiten Ebene: Ja
Datenausführungsverhinderung verfügbar: Ja
First test: Installing my (working) Server on my W10 laptop
Message: C0.WEX.Prototype11.Prototype: Adding Pages...
Error: NativeBridge: Failure to load the brige library.
Error: System.ComponentModel.Win32Exception (0x80004005): Das angegebene Modul wurde nicht gefunden
Error: Failed to initialise the NativeBridge.
I'll now try to add the NativeBridge to the laptop.
Okay now with added logging to NativeBridge.cs I get the following on my working PC:
Message: C0.WEX.Prototype11.Prototype: Constructing property sheet.
Message: C0.WEX.Prototype11.Prototype: Initializing shell extension...
Message: C0.WEX.Prototype11.Prototype: Shell extension initialised.
Parent folder: <none>
Items:
D:\Pascal Ried\Desktop\ServerManager.exe - Verknüpfung.lnk
Message: C0.WEX.Prototype11.Prototype: Adding Pages...
Message: ===== NativeBridge.Initialise =====
Message: resourceName: SharpShell.NativeBridge.SharpShellNativeBridge64.dll
Message: resourceStream.CopyTo(tempStream): C:\Users\Pascal Ried\AppData\Local\Temp\f9d695e4-65f7-4d48-ae66-e72788fc4e5c.dll | SharpShell.NativeBridge.SharpShellNativeBridge64.dll
Message: bridgeLibraryPath: C:\Users\Pascal Ried\AppData\Local\Temp\f9d695e4-65f7-4d48-ae66-e72788fc4e5c.dll
Message: Bridge Initialised
Message: Creating property page handle via bridge.
Message: C0.WEX.Prototype11.Prototype: Created Page Proxy, handle is 1d85d890
Message: C0.WEX.Prototype11.Prototype: Adding Pages (Done)
Interesting fact 1: The resource "SharpShell.NativeBridge.SharpShellNativeBridge64.dll" is defined by the manifest via:
using (var resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resouceName))
But, they are not in my assembly, but in the "SharpShell.dll"
So I guess it doesn't matter if you copy the file or not, it is included IN the SharpShell.dll itself.
Interesting fact 2: The resource/dll is copied to a temp path with a temp guid - I searched and found this temp dll. Deletion will force it to be recreated with a new GUID-name.
Interesting fact 3: I checked the same for my Laptop, but here everything up to the point, where the "Library" is loaded, everything is fine but then this still happens:
Error: NativeBridge: Failure to load the brige library.
Error: System.ComponentModel.Win32Exception (0x80004005): The specified module was not found.
Error: Failed to initialise the NativeBridge.
Again I checked, the DLL is in the temp-path - but still not working. Something else missing? Which "module" does the error mean exactly, maybe something else is missing? Why does it work, as soon as you compile the VC-project on your computer once?
No progress. Would love to debug/test further and figure it out but have to go for around a week. I will come back Monday next week.
Hope you find a solution for your vanishing problem in the meantime and post your solution here ;)
Some recommendations:
System.Diagonstics.Debugger.Launch()
and System.Diagonstics.Debugger.Break()
Hey ElektroStudios, I am back - did you find a solution or try anything out yet?
No, sorry, the library is to buggy, I don't have enough motivation to spent a lot of time in trial and errors testing things that will not solve the problem at the end. It should responsability of the author, not you neither me, to determine why a simple shell-extension or the default shell-extensions included in the zip, can't be installed in a fresh Windows 10 installation for some users like me, or why the contents of the tabpage disappear for no reason. But this library seems not updated, discontinued, and the author does not provide help, so, I can't deal blindly with all the problems that this lib is causing me.
Thanks for all your time and help.
@ElektroStudios Get that, and have fun / good luck finding a solution. Drop a line when you find a solution (with any other tool/library/etc.) tyvmia
Hi @ElektroStudios @Countryen, there are some assorted bugfixes which I included in version 2.4 which I've just published, it is possible that one of them will help with the issue.
I've been unable to do any maintenance on the code for a long time, just too busy at work. I'm trying to catch up with the busiest issues now.
I apologise for the frustrations - there are indeed bugs with the library, but the shell is an absolutely pain in the ass to work with. Any tiny mistake with marshalling can lead to what seem like silent failures - even setting up things like logging can be very difficult. The property sheet in particular is a bit of a nightmare due to the need to have an intermediate bridge layer.
@ElektroStudios I sympathise with your frustration - I've gone through it many times over the years when working with this library, the shell is a pain and no doubt this code adds issues too. But as you've seen there's a real lack of decent stuff around for dealing with the shell. At the very least this gives a starting point. But property sheets have been particularly challenging.
Anyway, my thoughts so far:
Virtual Machines
I doubt the virtual machine is the issue. I've not had a Windows machine for years, all SharpShell development for me is on a virtual machine (one of the reasons I've had less time to maintain it - I have to keep a VM dev environment up to date).
The Bridge
The bridge is indeed embedded into the main assembly (both a 32 bit and 64 bit version), then extracted and loaded as needed, as you identified.
Potential Issue 1: Incompatibilities
I think this:
https://github.com/dwmkerr/sharpshell/issues/177#issuecomment-419977280
Is interesting. I have a feeling that a root cause of many issues is that if the Server Manager, or Server Registration Manger is not from the same build as the SharpShell assembly, registration can fail.
Potential Issue 2: The Bridge Failing to Load
When I see this:
https://github.com/dwmkerr/sharpshell/issues/177#issuecomment-420340982
I think you may have stumbled upon something. The bridge is extracted to a temp location, then loaded. It fails to load, but the file seems to be in the temp location. One question - do you have corporate anti-virus on your laptop? I think that some systems will actually block access to a file on disk until it has been scanned (particularly in the case of system files). This can be done at the kernel level, which might explain why in some cases it just seems to fail to load the file.
Potential Issue 3: Incorrect Marshalling
Non-ascii characters have been an issue in the past (see https://github.com/dwmkerr/sharpshell/pull/116).
Next Steps
The best suggestion I can make at the moment is to simply improve the documentation around logging, find a standard and sensible way to enable log output and write to a given location, then add a lot of extra logging to these methods (as you've been experimenting with) to gather more data. I've opened #189 as an RFC for thoughts on logging.
@dwmkerr
I still had the Visual Studio project saved in a forgotten directory, so I returned to have hope when reading your comment and the update you did, unfortunately the problem persists... I have registered the extension, I have opened like 3 file properties at once, and the contents of the property sheets (two of them) disappeared, and finally Explorer literally crashed (explorer automatically reseted itself).
I can discard antivirus problem because I don't have, and about the non-ASCII characters, well... to ensure I put just one label control in the UI with common English alphabetic characters, and the problem persist.
Anyway, I want to give you thanks because really I didn't expected to see updates neither to see you reading and answering this thread; I really thought SharpShell was discontinued, sorry for thinking that. You tried to solve the problem/add support for this strange bug, and also you had patience reading this thread, so really, really many thanks!, however, It didn't solved nothing for me. :(
I can't imagine the pain you are talking about because my knowledge with C/C++ is basically null, but I can imagine something when you are (apparently) the only developer that managed to bring us shell-extension functionalities in .NET over the past years, so probably this is as difficult to do that very few people or anyone except you can and/or is interested in making this type of wrapper/whatever.
If I'm not asking too much, could you explain me how to manage logging with SharpShell to try identify on my side the problem that is causing this?.
@dwmkerr
If helpful, see, this is the stack trace that Windows Error Reporting (WER) registered when the Explorer crashed:
( it is in Spanish but I prefer not to google-translate it because maybe words can be lost in translation )
...clearly something is throwing and not handling a System.NullReferenceException, but I can ensure you that is not thrown by a coding mistake in my source-code because as I said you I also tried with just adding a label control in the UI.
Type: Error source: .NET Runtime
Aplicación: explorer.exe
Versión de Framework: v4.0.30319
Descripción: el proceso terminó debido a una excepción no controlada.
Información de la excepción: **System.NullReferenceException**
en System.Windows.Forms.ListView+ListViewNativeItemCollection.get_Item(Int32)
en System.Windows.Forms.ListView+ListViewItemCollection.get_Item(Int32)
en System.Windows.Forms.ListView+ListViewNativeItemCollection.Clear()
en System.Windows.Forms.ListView.Dispose(Boolean)
en System.ComponentModel.Component.Dispose()
en System.Windows.Forms.Control.Dispose(Boolean)
en PropertyPage.Dispose(Boolean)
en System.ComponentModel.Component.Dispose()
en SharpShell.SharpPropertySheet.PropertyPageProxy.Cleanup()
en SharpShell.SharpPropertySheet.PropertyPageProxy.CallbackProc(IntPtr, SharpShell.Interop.PSPCB, SharpShell.Interop.PROPSHEETPAGE ByRef)
Type: Error Source: Application Error
Nombre de la aplicación con errores: explorer.exe, versión: 10.0.17134.165, marca de tiempo: 0x4031a9f8
Nombre del módulo con errores: System.Windows.Forms.ni.dll, versión: 4.7.3056.0, marca de tiempo: 0x5a8e5a21
Código de excepción: 0xc0000005
Desplazamiento de errores: 0x0000000000c35a08
Identificador del proceso con errores: 0x6610
Hora de inicio de la aplicación con errores: 0x01d46dc1ace54fbd
Ruta de acceso de la aplicación con errores: C:\WINDOWS\explorer.exe
Ruta de acceso del módulo con errores: C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\46cc21f2e6e3d23302f401cb2a4f55ad\System.Windows.Forms.ni.dll
Identificador del informe: 01203a72-25be-43cb-96f2-9994ea53b9a9
Nombre completo del paquete con errores:
Identificador de aplicación relativa del paquete con errores:
Please note that I'm sure it is not a fault on my source-code, I'm not doing anything strange retrieving items in the listview, If I open the property sheet for any file it works, it just crash randomly when opening multiple property sheets at same time (on multiple files).
This can be a hint that maybe it is a bug related to something that you maybe can notice with this info, in SharpShell?
I think it will cost me a while, because I remembered to had problems and requisites to compile SharpShell, but I will try to compile SharpShell and adding some try/catch logic in this procedure below and also to check whether any of these members is null (and so if for that reason is thrown the System.NullReferenceException):
private void Cleanup()
{
// Destory the target.
Target.Dispose();
// Destroy the host.
User32.DestroyWindow(HostWindowHandle);
// Clear the lot.
Target = null;
HostWindowHandle = IntPtr.Zero;
}
...I really have hope to solve the problem cheking that, the "Target.Dispose()" smells bad for me.
Yeah, I discovered that the call to "Target.Dispose();" is which throws System.NullReferenceException, because for some unknown reasons it can be (it is in my PC) called after the contents of the page disappear, or in other words, after "Target" is disposed.
I think that really needs a fix, a simple check to determine whether "Target" is null before attempting to dispose in "Cleanup" method. This will not solve the problem, but at least will not cause (hopefully) a Explorer crash after the page gets disappeared/disposed.
EDIT: well, I added this modification:
try {
if ((Target != null) && !(Target.IsDisposed)) {
Target?.Dispose();
}
} catch (Exception ex) {
Logging.Log("Failed to dispose 'Target' instance.");
MessageBox.Show("Failed to dispose 'Target' instance");
MessageBox.Show(ex.Message);
} finally {
this.Target = null;
}
However, I noticed that even with the null and disposed check, Target.Dispose() is still called !! (and so the messageboxes are shown informing about a NullReferenceException). How this can be possibly if I'm ensuring it is not null???, I'm doing a damn triple check for that!. This is really a nightmare as you said. Note that this only happens when trying to close the property pages that disappeared, when closing the others that are still visible it does not throw the exception.
...but at least that try/catch block fixes the NullReferenceException from crashing Explorer process when the property pages disappear, so I think it is a good fix to prevent more issues (I refactored the code and made a pull request).
However, that is only part of the problem, because that is not the real problem, something that I didn't identified is what is causing the page to disappear/be disposed before the "Cleanup" method tries to dispose it.
I put an eye on "CallbackProc" function, I discovered a strange thing abut this, see, when the contents of all (or various of) the shown property pages strangely disappear, and after you close one of those dialog windows, the message PSPCB.PSPCB_RELEASE is sent, but referencecount becomes 0 for no aparently reason, and so, "Cleanup" method is called. This is repeated for every remaining opened property page/dialog window, when closing any of them, until the last one is closed.
That is very strange for me, maybe could be a good hint for you because you are the expert on this.
I will try to test other parts of the source-code a little more... but I don't hope to find anything more useful than that.
Regards!
EDIT:
After I seen this:
// Create the dialog proc delegate (as a class member so it won't be garbage collected).
dialogProc = new DialogProc(WindowProc);
callbackProc = new PropSheetCallback(CallbackProc);
I thought that maybe the problem could be cause of the GC, because its really so strange that the contents of the property pages disappear (and not for all the opened property pages) strangely after opening multiple of them, it seems random, and what "ramdom" factor can cause this?: the GC, I mean, the members that are elegible to be disposed.
I don't have idea whether this can be the problem, but until I have ideas I will try all what I can, so I filled the entire PropertyPageProxy class with calls to GC.KeepAlive() and GC.SuppressFinalize() to try keep every single declared member from being garbage collected (and finalized), but I had no luck, the problem persist.
Anyway maybe the way I did this is not the proper to ensure members will not be collected, so I'll request for a more proper, objective test focused on checking GC things to try identify or discard this cause for the bug.
EDIT:
Next round: replace all IntPtr objects in SharpShell with HandleRef, to ensure always managed object points to the right unmanaged handle it is if changes. Or using SafeHandles maybe...
I replaced all IntPtr with HandleRefs in these classes: SharpPropertySheet, PropertyPageProxy.
The property page is shown and works as expected with the modifications I did... but only until the disappearing problem occurs again, so It didn't solved the problem.
I also improved or at least personalized the InitializeComponent method of the SharpPropertySheet class and I also overriden some base methods there to try identify possible painting mistakes on the property page that maybe could cause a disappear effect. It didn't solved the problem too, and I didn't found anything.
Anyway I know that I'm loosing time trying to identify possible painting problems because... well, clearly when the property page "disappear", the "Target" member is disposed and the "Cleanup" method throws a null reference exception because it tries to dispose it, this means for sure it is not a simple painting issue that clears all the controls in the property page, It is something that for whatever reason frees the property page (but not the tab page).
...and for that reason, I start thinking the problem could be caused by the nativebridge but I really have no clue about it.
I really would like to discover the reason why some property pages DISAPPEAR, if its not a GC issue, neither a window handles issue, neither painting issues... what the hell it is!!!???. Anyway of course I didn't covered all the possible errors/bugs that can be about inappropriate usage of GC, of handles or of painting, just I covered a little set of possible related errors.
Dunno what more I could try, this is very tedious to realize, and my frustration is high, sorry.
I'll keep subscribed for news here. Thanks for read.
@dwmkerr nice to see you're up and working on this project (and this issue) again ;)
To your question from:
Potential Issue 2: The Bridge Failing to Load
When I see this:
177 (comment)
I think you may have stumbled upon something. The bridge is extracted to a temp location, then loaded. It fails to load, but the file seems to be in the temp location. One question - do you have corporate anti-virus on your laptop? I think that some systems will actually block access to a file on disk until it has been scanned (particularly in the case of system files). This can be done at the kernel level, which might explain why in some cases it just seems to fail to load the file.
I don't have any anti-virus on my laptop, as it's just for testing and a fresh windows 10 w/o anything else (maybe the default windows 10 firewall, but never messing with that). On my actual PC (where it works, after compiling the native bridge once) I do use Symantec Norton Anti Virus.
I'll try some more with the new version you just published.
@ElektroStudios
If I'm not asking too much, could you explain me how to manage logging with SharpShell to try identify on my side the problem that is causing this?.
Use the SRM tool (srm.exe
) tool, see the wiki for full explanation here
https://github.com/dwmkerr/sharpshell/wiki/Debugging-&-Diagnostics
Basically to activate run:
srm config LoggingMode File
and then to set the path of the logfile just
srm config LogPath "%TEMP%\SharpShell.log"
(or any other (absolute) path you'd like)
Logging in CSharp:
Logging.Log("This is a message.");
Logging.Error("This is an error.");
or inside a SharpShellServer
:
Log("This is a message.");
LogError("This is an error.");
@ElektroStudios Just read your whole story and noticed that quiet fast:
Aplicación: explorer.exe Versión de Framework: v4.0.30319 Descripción: el proceso terminó debido a una excepción no controlada.
You're using .NET v4.0? I never tried it with .NET v4.0 only with v4.5 - maybe there's a difference here. I will try it with .NET v4.0 for once. Are you developing with the Client Profile or Standard v.4.0?
Would you be interested in trying to use/register my example Server (that is working for me on my PC? After I get it running on my laptop, ofc.)? I am curious if my simple extension will work on your PC. I will share the code (sample project), too, and you can scan it with ILSpy or anything to prove It's not harmful easily.
@Countryen
Thanks for the tip about the logging tool !!
About this:
Framework Version: v4.0.30319
I'm targeting .NET Framework v4.7 in my project, but what you see in that quote is correct, it is the same version that returns the property Assembly.ImageRuntimeVersion (eg. string version = Assembly.GetExecutingAssembly().ImageRuntimeVersion; ), because that is the CLR version, not the .NET framework libraries version... indifferently of whatever the bad chosen words in the description of that Spanish text says ("Versión de Framework"), that is why I don't program in my own language, it only lead to terminology confusions like this one, but the stack trace I only can have it in the O.S. language (I don't know whether the language for stack-traces in WER can be changed to English) so... sorry for that.
Please read here if you have any doubts about CLR version and .NET Framework version, it is well-explained:
Would you be interested in trying to use/register my example Server (that is working for me on my PC? After I get it running on my laptop, ofc.)? I am curious if my simple extension will work on your PC. I will share the code (sample project), too, and you can scan it with ILSpy or anything to prove It's not harmful easily.
Of course I would like to do it.
Thanks for read.
Hey there, I did some testing, with fascinating yet frustrating results.
I can now reproduce the problem. I've got 2 Servers now - a working one (PS don't disappear) and a not working one (PS disappear).
Similarities:
Differences: The working Server is done with my local copy and self compiled clone of sharpshell/master@v2.3.2.0 and is installed/registered with that same version of ServerManager (also compiled by myself).
The not working Server, however, is using the new sharpshell v2.6 from Nuget and the downloaded ServerManager from the newest release (v2.6).
Next Steps:
Note: I guess it could also be that I just need to compile the native bridge again with version 2.6 or that I just made a bloody mistake.
Maybe you wanna try it with an older version and the self compiled Server Manager / SRM yourself first.
Local Changes I made to sharpshell/master@v2.3.2.0:
Result shows me, that I can reproduce the error and maybe now fix/explore it :) Please be sure to check out my (working) example server, as soon as I finish them. See you soon.
Next Steps:
* checking further differences between the servers
Did you used same Windows SDK version for both projects?.
Also, if helpful, maybe using a diff tool (ej. WinDiff, or UltraCompare) to compare code change additions and removals between source-codes of v2.3.2.0 and v2.6 could help to find something that is causing the property sheet incorrect behavior.
Thanks for your investigation.
Did you used same Windows SDK version for both projects?
Sorry, I don't know. I didn't reference any Windows SDK, only
attached see both project files buggy.csproj.txt working.csproj.txt
I don't think you need the Windows SDK for the C# project, only for the native bridge, do you?
About using the diff tool: Will do that after reproducing in a cleaner context. (SVN diff)
Back again, now with two clean example servers, see attached files below. Please contact me, if you don't trust a direct download then I'll create a simple repository for you here on github. Go ahead and check the SHA256 after download to verify. I also included full sources, so you can compile yourself / check the code.
Creation Process: I created 2 (almost) identical server with VS2017. I then checked out 2 tags:
Then I compiled the sharpshell-librarys on mc PC. I also compiled the respective ServerManager.csproj
The BAD Server references sharpshell v2.6.0.0 The GOOD Server references sharpshell v2.3.2.0
No additional modifications to the source code done (except removal of post-build-srcripts).
Contents ( XXXXX = Good/Bad):
How to Build, Install/Register, Test yourself:
Please be precise. Try to always install & register for both x86 and x64, restart explorer always when done (De-)Registering/(De-)Installing and try to use only ServerManager. Also be sure to use the right version of the ServerManager. GOOD = v2.3.2.0 | BAD = v2.6.0.0
Good luck, I am looking forward to your test results and if it's the same result for you as it is for me. Note: I did not yet compile the native brdige for any of the projects (will do this next).
@dwmkerr Maybe you wanna check them out, too? Also one big question: I can't seem to install both of them at the same time. Why could that be? They do have different
But after registering the second (either one) the first won't show up. ServerManager will still show both Servers as installed/registered.
Okay cool, all runs fine then I upload the zip and download the zip and SM says "This is not a SharpShell Server" ... have to look into that I guess
Edit: Okay me stupid. I just needed to "enable" the files first because Windows blocks them. I checked the SHA256 and they were the same so no big deal I guess. Did it for the DLL and it worked but to be on the save side, just do it for every file (except the files in the "Source Code" folder)
Right click the file (dll, config, etc.) and go to General. At the bottom it asks you for access.
I have bad news...
Same problem with the "BAD" sample.
I followed the steps, I was precise, I used the server managers included in both folders, individually to install one or install the other extension, and I restarted explorer each time after registering and unregistering.
In short, the "GOOD" sample it does not work for me.
Anyway, I've used dnSpy to search for differences between the compiled code of the "GOOD" and the "BAD" extension assemblies, but I found nothing... apart from the tiny changes that you already described (GUID, name, etc).
Hey, at least they work (thanks for testing, anyways) ;) Sad it's not the expected result - but maybe for others/dwmkerr it will be.
Will try/test the native bridge (and probably other stuff) real soon.
So now both example servers (GOOD & BAD) work for me, the sheets don't disappear.
What I did?
By building all of them I also built the Native Bridge (now for the first time in 2.6.0) I am curious to see, if this will happen with 2.6.1 as well.
My guess would be: Compiling/Building the native bridge (or loading) does something to the PC/registry/OS that is globally effective and once that is done, it works. Did you ever build the bridge yourself? Maybe for an earlier version of sharpshell? (As the case for me from 2.3.2.0 to 2.6.0.0)
That's why someone who already built the whole thing won't even notice the problem.
I want to know, how to reproduce it to prove my point, though. Will keep digging (Dig Dig, I'm a Dwarf ♫)
Okay something must be trolling me. I noticed that I actually did NOT compile/build the Native Bridge. Compilation failed saying "you need to have Windows SDK 8.1" or smth.
Still, my (previously) BAD example now works w/o a flaw. And I swear by beloved Nullable Reference Types in C# that the BAD example did not work for me just before I downloaded and built the solution. I opened up to 5 sheets and all (or sometimes some) of them disappeared, exactly like they did for you in the video.
So what's going on?
Okay - this is good (kinda). Now I can switch the BAD example from working to not working and back at will (disappearing sheets). It works, when I don't use file debugging (DebuggingMode = 1). It doesn't work, when I do use file debugging (DebuggingMode = 5).
Guess I didn't notice that I never changed back to logging, when I tried it with the new native bridge thingy... Tomorrow I will install SDK 8.1 and compile the vsc-project myself.
Hi @ElektroStudios and @Countryen I'm flat out at work for the next couple of days so it'll be a short while before I can catch up on all developments. But in the meantime, one issue I noticed which I'll throw in here (sorry if this is a bit out of context, I thought it better to share even though I don't have time today to follow all the new developments in the thread)
When you build sharpshell, it will only build one version of the native bridge. That'll depend on what your current build configuration for it is (either x86 or x64). This is essentially quite a bug - because every build should actually be creating both binaries, because the final SharpShell assembly contains both an x86 and x64 embedded assembly. So ideally I will need to update the build process to include a script which actually generates both.
In the meantime, if you are primarily testing x86, make sure you set the native bridge build configuration to x86 for now, x64 otherwise.
When you build sharpshell, it will only build one version of the native bridge. That'll depend on what your current build configuration for it is (either x86 or x64).
In the meantime, if you are primarily testing x86, make sure you set the native bridge build configuration to x86 for now, x64 otherwise.
But by default SharpShell solution is targeting "AnyCPU" and the "Prefer 32 Bit" is not ticked, that means it will run x64 on a x64 O.S, but I'm not sure whether by default the x64 nativebridge is embedded in SharpShell assembly when SharpShell project targets "AnyCPU", or it is embedded the x86 nativebridge, or both nativebridges.
I wanted to test a bit more by targeting SharpShell to x64 or x86 architecture and same for the nativebridge project, I mean, to ensure both projects are matching same architecture due the commentary of @dwmkerr about that, but I can't compile the nativebridge project, it has a lot of compiler errors with the windows headers, like "ctype.h cannot be found" or something like that (same for "string.h" and many other headers, but not all of them).
I'm not experienced with VC++ development but I have the Windows SDK 8.1 and 10.0 installed, and the VC++ components from Visual Studio installer, I think I have all the necessary to compile it, but for any reason I can't.
OK good news!
I can reproduce the failure. And I was not able to reproduce when #213 is in. In the screenshot above my 'Resources' extension has disappeared.
So somewhere, I think the route cause is just mis-management of the lifecycle of the sheets. As you've seen we attempt to dispose of something we're already supposed to have cleaned up. At this stage I think the best thing to do is temporarily bring in the fix we've got in #213, but add a bunch more diagnostics to the lifecycle methods and check again how they're implemented...
@dwmkerr I'm very happy that you finally can reproduce the problem. At the end my patience and especially @Countryen patience and effort helped to go on the right direction, now together with your patience and effort too.
add a bunch more diagnostics to the lifecycle methods and check again how they're implemented...
So now, for my part, the only thing I can do is wait (for a new release of SharpShell to test it).
If need something from me, just comment here.
Thanks everyone.
@ElektroStudios Couldn't compile the native bridge, too. Maybe you can right click the project (in Solution Explorer) and "re-map" the project to your installed SDK. (I had to)
After that, now I can compile. (Note: I don't really know what exactly happens and if that is "allowed" or not - it works, though)
@dwmkerr That's great news, I really wan't to check out your resolution, once your done. For me, everything (compiled with v2.6) works fine until I enable logging (File OR Debug), then the disappearing begins. - Also tried it on different PCs with the exact same result (all of them with VS2017 installed but not with the project)
The server from sharpshell@v2.3.2.0 works flawlessly on any pc for me (even with logging enabled). Sadly, applying #213 locally doesn't change it for me in any shape or form.
I've fixed another bug which can make it difficult to diagnose this issue see #221. @ElektroStudios would be keen to see if this looks like your bug. I doesn't solve the null reference exception, only a cosmetic drawing issue, so I don't think it fixes your issue, but at least removes some of the noise. Hopefully easier to continue debugging now. Likely some more small fixes will come in as I test your PR and try and consistently reproduce this issue.
I doesn't solve the null reference exception, only a cosmetic drawing issue, so I don't think it fixes your issue,
dwmkerr closed this in #221 some time ago
if not resolved yet, why closed?
@dwmkerr
I downloaded SharpShell as a ZIP from GitHub with the changes you made, I opened the solution and in nativebridge project properties I changed Windows SDK version to Windows 10 as @Countryen pointed out, otherwise I can't compile it.
Then, I compiled it (default build configuration and default everything else). I used the resulting SharpShell.dll assembly to compile my extension, I registered it with the ServerManager, and woala!, the property page does not disappear anymore.
So at the end the cause of the bug was a lack of WM_ERASEBKGND message handling?.
Anyway with these delicate things I think can't be sure whether this issue is really fixed until some more people do a test apart from me (@Countryen, its your turn to test the changes!), see for example that @Countryen compiled before a "GOOD" sample that at the end it was "BAD"...
I mean that still exists the chance that maybe the property page of my compiled extension it just only works fine in my PC, because this behavior happened before as reported in this thread.
HOWEVER... as I said my property page does not disappear anymore, but, after opening multiple property sheets, and clicking in one of them, Explorer crashes. I can reproduce this crash all the time just by opening many property pages (8 or 10 is enough for me) and giving enough time (less than 1 minute) until the crash occurs when I click one of those opened property pages. @dwmkerr, can you reproduce what I'm saying?.
Note that I applied #213 in my local downloaded copy of SharpShell source-code, but Explorer still crashing. So the call to Target.Dispose in "Cleanup" method couldn't be the cause of this crash.
Also, excuse me, maybe the next question is due not enough experience with GitHub and pull requests from my side, but I'm not getting the reason why #213 is still not merged/applied since it is just a null check error-handling that does not affect performance, it seems helpful to avoid a explorer crash not only with the issue we are discussing in this thread, but for any other possible future scenario in which a call to Target.Dispose could be done when Target is null...
I mean... in any case it is a (little) improvement to the final code. It is not?.
@ElektroStudios Hey that's really, really nice to hear - that your extension now works (for you anyways). I will test it as soon as possible but won't come home till Sunday. Happy Halloween.
Hi, I have an strange problem. Note that I took the official filedate property sheet sample as a guideline to create my property sheet, and I reproduced this issue with a "empty" property sheet too, its not an issue about my source-code.
The thing is that the entire content of my property page disappear when I open multiple property sheets (of different files). I mean, first I select a file and I do right click to open the file details and I go to the tab of my property page, well, If I repeat this procedure without closing any of the opened windows, then at the end all the controls of my property page disappear, so I only see a empty tab page.
A simpler way to reproduce it: Pick an amount of 5 or 10 files, one by one do right click to open the details and to go to your custom property sheet, don't close any of the opened windows. Just wait some time and the controls of your custom property page will disappear on the first opened window, and so on in the next opened windows.
I hope the bug report was understood.
This can be reproduced with at least version 2.3.2.0, in Windows 10 x64 with a x64 shell-extension.
Any solution for this?.