The process cannot access the file ... because it is being used by another process.

Topics: ASP.NET 2.0
Aug 14, 2008 at 3:14 PM
I just installed v1.4.5, and i very frequently get:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'E:\CustomerData\webspaces\webspace_00106051\wwwroot\Blog\App_Data\datastore\extensions\CodeFormatterExtension.xml' because it is being used by another process.

Not just the codeformatterextension - it can be any of them.

Is this a blogengine thing, or is it my hosting service? i would guess the hosting service, but can any help me solve my problem?

/johan
Aug 15, 2008 at 12:27 PM
When I updated to 1.4.5 I got the same message every time a recompile occurred. When debugging in Visual Studio it did not seem to be anything else wrong but when I uploaded to the hosting service all of the Extensions stopped working! Another remarkable thing was that the site stopped serving .ico files?!

Now I've rollbacked to 1.4.0 again and everything works fine. Extensions work and .ico files too!

I'm guessing it has got to have something to do with the ExtensionManager but I will look into it futher.

Best regards
Rickard Nilsson
http://rickardnilsson.net
Aug 15, 2008 at 7:55 PM
Now I've tried v1.4.5.6 and it has the same problem. For me it is allways the \App_Data\datastore\extensions\BBCode.xml file which is not accessable. It has something do to with the XmlProvider\DataStore class. Investigating further...

/Rickard
http://rickardnilsson.net
Aug 26, 2008 at 7:24 AM
I had the same problem & rolled back just the Extension Manager related classes of 1.4.0.0 & it all works ok again.  I'm going to add this to the issue tracker.
Oct 7, 2008 at 6:09 PM
This bug has been fixed
Take a look here
http://www.codeplex.com/blogengine/SourceControl/ListDownloadableCommits.aspx

and download the latest set.
Nov 13, 2008 at 2:01 PM
This bug has returned.

Bad code got readded to the project.

Specifically App_Code\ExtensionManager\Manager.cs line 226.  It should be this (grabbed from the initial fix):
Stream stm = (FileStream)o;
Coordinator
Nov 14, 2008 at 3:56 AM
You should be ok if you are using change set 16659 and up. Line 226 in Manager.cs did not change in the latest builds, the fix was mostly in the XML data provider. Reason for locking the file was because of "using" statement while reading a stream. It did not occur to me that even when you specifically close stream, if it is inside "using" it'll stay alive till garbage collector gets to it. This is why this error was thrown randomly and hard to catch, sorry for getting you all into trubble...

If you are using latest builds (you need to update both DLL and web project) and still running into locking, let me know.
Nov 14, 2008 at 4:40 AM
This bug is in the very latest code (18133).

In 16659 the Manager.cs file had Stream stm=(FileStream)o; at line 226.  This is not in 18133, which causes me to have this error.  Once I fixed it the error disappeared for me. 

Line 226 in 16659 needs to be reimplemented in the next bit of codes.  It is the ONLY difference in the extension manager code from 16659 to 18133.

I always recompile my code and such.  This is a current bug in the code.

- Clarence Klopfstein
http://www.ocdprogrammer.com

Coordinator
Nov 14, 2008 at 2:57 PM
Clarence, what do you see at line 226 in 18133 build? To me, DiffMerge does not show any difference, it is still the same:

226. Stream stm = (FileStream)o;

Is this any different for you then here?

Nov 14, 2008 at 5:14 PM
Um... I'm confused. 

I know I checked, double checked, and triple checked the code to make sure it wasn't me using a mix match of a build.... guess I should have checked one more time!

Welp, glad to see its still in there.  Thanks!