|
Okay, I have had this problem in the past. However, the projects were small personal projects which I wrote at home, for fun. Now I am writing applications here at work. And it is beginning to hinder the process greatly.
I have noticed that whenever I use a custom control (or, for example, the free DevExpress XtraEditors controls which I registered for and downloaded) in any project, I receive the error:
"Unable to copy file "obj\Debug\LpsApp.exe" to "bin\Debug\LpsApp.exe". The process cannot access the file 'bin\Debug\LpsApp.exe' because it is being used by another process."
When I first open the project and I work on a form which uses a custom control it is okay. However, once I make a change and re-build the project a few times I begin to receive the error message. Like, every time from then on. Once I close VS2010, delete the bin/Debug directory and restart, it works fine again for a few builds. Then it goes back to the same crap. This is highly frustrating.
I have another project which was perfectly fine, for months. That is, until I made an upgrade and it involved a custom control from right here on good ol' CodeProject. I then began to receive the same error message. But as long as I do not open the forms which use them and make changes, and I do not make changes to the custom control itself or its code, everything is fine. I restarted the current project a while ago and I have been working on a different feature. And it has been flawless.
Why does a custom control do this? Is there any way around it?
I have tried deleting the .SUO file, the 'bin' folders, the 'obj' folders. I have tried the pre-build event which renames the file with a '.locked' extension. As well as a few other "solutions" which I found online. They work for two or three builds and then it is right back to the same thing.
Thanks CP.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
To me the scenario you describe is slightly ambiguous: are you describing:
1. you have Project 'x' open in VS, and you add a reference to the compiled dll of UserControl 'y,' then use it in 'x, and then, after some usages, you get the compile error.
... or ...
2. you have Project 'x' open in VS, and the source code for UserControl 'y,' open in that Project, then: you create an instance of 'y, either by drag-dropping from the ToolBar at design-time, or in code at run-time, which you then use in the code, and then you get the compile error.
If #2, then does the error occur reliably when you have made changes to 'x, but have not changed the UserControl source code, or, does it happen after you have changed the UserControl source ... or does it happen in both cases.
The cases where I have experienced the same error have usually involved compiling in 'DeBug mode, and having the vshost.exe enabled in the Project preferences, and then some error has occurred at run-time which has left a window open by mistake, in which case: sometimes I have to open the TaskManager and kill that process.
best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
|
|
|
|
|
Thank you for responding and explaining a bit. I apologize for the ambiguity. The scenario is like #2, I guess.
I just now went back to it. And I built the solution, made a change to one of the properties of the DevExpress control (in its parent form), hit Build again and it threw the error message. So why is it that changing something for the control causes this? Where is it getting stuck?
Process Explorer (from SysInternals) shows that Devenv.exe is the only process which is holding onto LpsApp.exe. Its own process is not running. Not in Task Manager either. If I close VS and restart it, it works for a bit until I make these changes. ???
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
I'm a little thick in the head at 02:58 GMT +7, so bear with me ...
The key issue I'd like to know here is did you alter the source code of the DevX control.
When you say "made a change to one of the properties ... (in its parent form) ... I assume you altered some attribute, some value, some setting, in the instance of the DevX Control on a Form ... yes ?
The other question is about to what extent this problem is reliably reproducible: can you say, for a fact, that if you alter property 'x' of the DevX control, build the app, run it, then quit the app, that this will fail after exactly #n times.
If the there is a varying result of failure to build/run given the same initial conditions, then I think a valid hypothesis would be that it was a problem with either the DevX control, or Visual Studio. If it's in the DevX control, I wonder what you could do by single-stepping through a 'run' ... if you can get that far. If it's breaking in the build, big problem.
good luck, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
|
|
|
|
|
BillWoodruff wrote: I assume you altered some attribute, some value, some setting, in the instance
of the DevX Control on a Form ... yes ?
Yes, I simply alter a value in the Property Editor while using the Forms Designer.
BillWoodruff wrote: The other question is about to what extent this problem is reliably
reproducible: can you say, for a fact, that if you alter property 'x' of the
DevX control, build the app, run it, then quit the app, that this will fail
after exactly #n times.
It will fail the first time I attempt to run the application after I make a change to a property of the DevExpress control. It does the same thing for EVERY DevExpress control. It also does the same for a custom control which I acquired here on CP. One modification to the control in the designer and it flips out. :P
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Hi Matt, In this case I would definitely report an issue to DevX, and check on their forums to see if anyone else is experiencing this, or if there's any fix. While I have not used DevX controls myself, they do have a great reputation for support, and quality, imho.
One final question: when you first used the DevX free controls, did they require conversion by VS 2010 to be compatible with whatever FrameWork version you are compiling against. If so, did you look at the conversion error report, if there was one: might be a clue there ?
best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
|
|
|
|
|
Thanks, Bill. No, they did not require conversion by VS.
But I have also encountered this issue with any other custom control. One which I found here on CP. And if I create my own custom controls I experience the same issue. Should I still contact their support?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Matt U. wrote: But I have also encountered this issue with any other custom control. One which I found here on CP. And if I create my own custom controls I experience the same issue. Should I still contact their support? Wow, well ... if you have this problem with any custom control, then, okay, it's certainly not just a DevX problem.
I'm baffled ! By the way, which version of VS 2010 are you using ?
best, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
|
|
|
|
|
I am running VS 2010 Ultimate.
I have the same copy installed at home. I have also encountered the issue on my home computer. Same version of VS. The only difference is the fact that my home computer is 32-bit and this work computer is 64-bit, both Windows 7 Professional.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Hello,
I have an input parameter which is defined as a bigint in SQLserver. I am using the Convert.ToInt64, to cast this variable before sending over to database. I am receiving this error - any thoughts to convert to another data type in C#? Long is not listed as an option.
C
Arithmetic overflow error converting expression to data type int. do nothing
|
|
|
|
|
long and System.Int64 are essentially the same and should work with BigInt . Posting your code might help us identify your issue.
Alternatively, you can try using SqlInt64[^]
|
|
|
|
|
SqlParameter enteredBy = new SqlParameter("@enteredBy", SqlDbType.BigInt);
enteredBy.Direction = ParameterDirection.Input;
enteredBy.Value = Convert.ToInt64(Session["CMSID"]);
sqlcommStoredproc.Parameters.Add(enteredBy);
|
|
|
|
|
Are you sure session["CMSID"] is a 64 bit int? People have been known to put all sorts of crazy things in there (maybe an unsigned version)
Check typeof(Session["CMSID"]) and see what you get. And if it is a string go kill yourself.
|
|
|
|
|
|
Value isn't a type. Check the type. Use the typeof operator.
|
|
|
|
|
Strictly speaking, you don't need to do the conversion against Value as it's an object , so it could contain anything you like.
|
|
|
|
|
When I do a Session["CMSID"].GetType() - I get it as System.UInt32.
I tried to cast as same and it still comes back with error.
|
|
|
|
|
But, you don't need to perform any cast. You're putting it into an object, so there's no need to perform the cast in the first place.
|
|
|
|
|
Post the code where Session["CMSID"] is initialized.
|
|
|
|
|
It is requesting from querystring.
Session["CMSID"] = Request.QueryString["CMSID"];
In the database it is set up as BIGINT datatype.
|
|
|
|
|
Try this:
enteredBy.Value = Session["CMSID"];
|
|
|
|
|
Same error message - Arithmetic overflow error converting expression to data type int.
Thanks for helping!
|
|
|
|
|
enteredBy.Value = ((Int64)((UInt32)Session["CMSID"]));
Maybe?
|
|
|
|
|
Specified cast is not valid. - the message I am getting.
|
|
|
|
|
And what happens if you just use:
enteredBy = Session["CMSID"];
|
|
|
|
|