Running Dokan as Windows Service #370
-
Hello all! |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 11 replies
-
There are usually no issues running Dokan as a Windows service. What you see here is probably some kind of handle leak, or something encapsulated in a I suggest you go through all your relevant code paths in your implementation and check for places where you open files, database connections, network connections and similar and make sure that any objects used temporarily in such code paths are disposed before returning back to native Dokan library. Objects that are not temporary and should remain active throughout the lifetime of a mounted drive need to be stored as a field in your implementation object or some other global location and then disposed afterwards when your drive gets dismounted. |
Beta Was this translation helpful? Give feedback.
-
No, sorry, I missed an important part of your stack trace. What you are seeing is more probably your |
Beta Was this translation helpful? Give feedback.
-
In which class is this? I would suggest that you add a service object using |
Beta Was this translation helpful? Give feedback.
-
Okay I see. So, you have a |
Beta Was this translation helpful? Give feedback.
-
There must be a reason why your |
Beta Was this translation helpful? Give feedback.
-
It could be that the reason it unmounts is connected to your objects getting cleaned up by garbage collector. Do you have some kind of logging in |
Beta Was this translation helpful? Give feedback.
-
I must say this is a bit surprising. It looks like you do everything correctly, although it was quite a while since I last time implemented this in .NET Framework. I guess you could try to add |
Beta Was this translation helpful? Give feedback.
-
So after some debug a lot of try error, was able to find a fix for now that works:
this is the previous code, and i was trying to mantain the _DokanINstance alive, but i have to make sure that dokan(new Dokan()) keeps alive as well! |
Beta Was this translation helpful? Give feedback.
So after some debug a lot of try error, was able to find a fix for now that works:
this is the previous code, and i was trying to mantain the _DokanINstance alive, but i have to make sure that dokan(new Dokan())…