Editing and saving a text file always shows Save As dialog - visual-studio-2012

I've been wanting to use Visual Studio 2013 Preview for editing some simple Python scripts. I open the script, edit as usual. But when I hit 'ctrl-s', Visual Studio 2013 Preview takes me to a 'Save As' dialog.
The file name hasn't changed, and the file path is right, so it's not damaging.
How can this be solved to allow me to save as I expect?

try running VS as admin or change the permissions of the file (right click on it and click properties ) and see if it's marked as read only.

Visual Studio 2012 exhibits the same behaviour if a file is opened for reading.
You can verify this using the handle utility from SysInternals.
[16:52:37] C:\windows\system32>
$ handle filepath
Handle v3.51
Copyright (C) 1997-2013 Mark Russinovich
Sysinternals - www.sysinternals.com
iisexpress.exe pid: 8896 type: File D04: C:\Projects\filepath.js
The following snippet was causing this:
var hash = Convert.ToBase64String(new MD5CryptoServiceProvider().ComputeHash(IO.File.OpenRead(filePath)));
Properly closing the stream when done fixed it:
string hash = null;
using (fileStream == File.OpenRead(filePath)) {
hash = Convert.ToBase64String(new MD5CryptoServiceProvider().ComputeHash(fileStream));
}

Faced same issue because there was no space on the disc. VS started working fine once i cleared some space.

I had the same issue with trying to save a css file (a SASS .scss file). I tried to run as admin and also checked the file to make sure it was not read-only, and also closed all other related processes (it was an SASS file that was being watched by gulp). It still did not allow me to save normally, and when I tried to save via the Save As dialog box, it said it was locked by another process. I then went to restart my VM, and was told by Windows 10 that there were pending updates. I applied the updates and restarted, and the problem went away. My guess is that in my case, the pending updates had locked things up, explaining why I could no longer save.

Related

Excel crashes when loading file that contains userform

Excel crashes when opening files that contain a userform
This is a known problem with a known solution workaround which is to delete a file called Excel.box from here:
C:\Users\SlowLearner\Application Data\Microsoft\Forms\Excel.box
According to this forum post the purpose of the Excel.box (& Word.box) file is:
Files such as Winword.box and Excel.box are associated with the
Control Toolbox you see when you are designing a UserForm in the
Visual Basic editor. The files contain information about the layout of
the Control Toolbox (additional tab pages, controls that have been
added or removed, custom icons, ...) If a user has never modified the
Control Toolbox in any way, there will probably be no .box file. By
deleting a .box file, you will restore the Control Toolbox to its
default (factory preset) configuration - this is the only way to do
that. Sometimes, the .box file becomes corrupted and must be deleted.
There are no negative side effects to deleting it.
Unfortunately Excel.box returns :(
It would seem that for most users the problem is fixed by deleting the file, sadly not for me.
I'd like to understand what is causing this problem to recur. A few points to note:
this (touch wood) is not impacting MS Word on my PC
I am using Office 2010, 64 bit version on Win10
I have not made any conscious change to form settings
if I delete the file > start Excel > UN-DELETE the file: everything works :-/
some other experiences with this issue here
For the time being I'll just check for and delete the file before launching Excel, but this is hardly an acceptable solution for the long term. Appreciate thoughts for a proper fix... TIA
Additional Information:
I have not fully explored the crash but so far it happens when:
starting the application by opening an xl?.m file with a userform
application does not get past the splash screen
crashes with the application's CRASH screen (... encounted an error...)
starting the application with a blank worksheet then adding a userform
crashes immediately with the applications CRASH screen displayed (see below)
The above crash happened after rebooting my PC, had a chance to explore it some more.
First I opened the file I had been working on (contains userforms):
annoyingly it opened without crashing
I did NOT enter the IDE
I closed the file (Excel closed normally)
Then I created a new worksheet
I opened the VBA IDE
right-click 'add UserForm' - Excel crashed immediately
(I aborted the recovery / search for a solution attempt)
Then I re-opened the file I had been working on
opened the VBA IDE (the project is PW protected)
the very instant that I entered the PW and hit enter Excel crashed
crash was same both times...
Safe Mode:
Crash still happens in safe mode - steps to reproduce:
Run: Excel /safe
Open VBA IDE
r-click add userform
crashes immediately
Creation of the EXCEL.box file
Based on visually observing the folder which had the Excel.box file I did some tests to try and see when it was created. Basically it seems to appear when one of the following happens:
- the UserForm tools box is closed
- the IDE is closed (after showing the userform)
I've also now tried to modify the userform toolbox by removing everything from it. Excel is still crashing after every restart of the application (which is odd as I was not able to crash it like that earlier).
Office Repair - not tested (yet)
Reluctant to try Office Repair as based on the following quote from here (scroll down: pg 1 reply 8 by Steve IT) I'm not expecting it to work :-/ (but will try if no other suggestions surface).
Thanks for the continued suggestions, however I have tried a repair and also removed Visual Studio 2013 and Office altogether (just in case VS was interfering) and reinstalled both, but it still throws the errors reported previously.
Other user profiles
Created a brand new user called 'test'. Test has the exact same problem.
This problem eventually resolved itself, not sure why. I continued to use Excel normally and it continued to crash so I would delete the offending .box file and start over...
As of Nov 2017 Excel no longer crashes with respect to this issue; my best guess is there was an automatic update that resolved the issue.
Looks like this issue still occurs and it is not just limited to Excel but also Powerpoint.
The fix as mentioned above works where you move / delete any files in the below folder location resolves the issue.
C:\Users\%username%\Application Data\Microsoft\Forms
It is highly likely that this error is caused by bad code in a macro or an Add-In that uses forms. The problem is replicating this can be difficult so you have to debug this in some way when it does crash out.
POWERPNT.box
EXCEL.box
are some of the files that get generated, where Excel or Powerpoint crash on the splash screen.
Try adding the command
ThisWorkbook.VBProject.VBComponents("UserForm").Activate
just before your
"UserForm".Show line.

Visual Studio 2012 constantly complaining that a file has been modified outside of the source editor

I am working on a parser, using the parser generator ANTLR in Visual Studio. Naturally, ANTLR is continually regenerating certain files. Every single time it does this, VS has a popup saying:
The file has been modified outside of the source editor.
Do you want to reload it?
The answer I want is always Yes to All.
Is there any way to tell Visual Studioto always assume I want to reload auto-generated files, without prompting?
Click Tools then options then under the environment node on the left choose documents then check the box that says Auto-load changes, if saved:
If you are using Visual Studio's internal editor and you know that nobody else is editing the file, you might be wondering why that happens. In my case, I realized I was working on a continuously backed-up network folder, that's why the file got re-saved every time I made a change on it and saved. So, if you can move your file to a local, not-backed-up folder, that might also solve this problem.

Sublime Text "Unable to save"

I didnt change any file paths and everything was working fine. I made one quick change saved it ok, did another change and I went to save it and got the following error. How can I solve this. It will save other files ok
Unable to save
D:\xampp\htdocs\websites\dev.liverpool\style\main.scss
Error:
MoveFileEx(D:\xampp\htdocs\websites\dev.liverpool\style\.sublae1.tmp, D:\xampp\htdocs\websites\dev.liverpoolzstylezmain.scss) failed,
Access is denied.
seems it's because Windows or another program is blocking the file. Sublime text uses a temporal file instead of editing the file directly, and when you save the file uses a API command to move this edited file to the original, so this command has restrictions when one file is locked and Sublime shows this alert.
Maybe this setting {"atomic_save": false} will work for you.
Go to the path where you installed sublime text 2 and...
Right click on the sublime_text 2.exe file.
Go to its properties.
Go to compatibility section under this.
Set its privilege level to "Run this program as an administrator".
Now change settings for all users and there also check the field "Run this program as an administrator".
Apply the changes.
I just solved the same issue on Sublime Text 3 beta, Stable Channel Build 3065 by doing the following under Windows 7:
Navigate to the Sublime Text 3 executable file, wherever you have it installed.
Right-click it and select properties.
Click on the tab marked "Security"
About half way down the tab, on the right hand side, under the list of group and user names is this little button:
Click it.
If your machine is setup the way I suspect it is (otherwise you probably would not be having this issue), you should be prompted for your administrator account credentials. Enter them.
Now, select the Users group in the list, then take a look in the box at the bottom labeled 'Permissions for Users'. Put a check mark in the 'Allow' column for the 'Write' item.
Click 'Apply'
Click 'OK'
You should be set. What this does is it essentially gives Sublime the ability to write files while running with regular user privileges, no administrator level access required. Upon taking a better look at your error, what is happening is Sublime Text is creating a temp file for editing, rather than editing to file itself, then attempting to overwrite the original file with the temp on save. The problem is that the program is not being run by a user with sufficient privileges to perform the overwrite, hence the failure with an 'Access denied' message.
A simple and effective solution: Right-click on the file you want to save, in my case it is index.html, go to the properties and uncheck read-only.
The Sublime text will start working fine.
I have come across this error quite many times and by un-checking read-only file attribute of index.html, I am able to get rid of it
I found out more ways to fix this:
Close and reopen the Sublime Text windows or
Open the file with Np++, add a space, save, quit, then you're prompted by ST to reload the file, click yes, and it works again... or
Open the FTP console to see if there's a transaction in progress - then cancel it
In my case the SFTP plugin seems to be causing this problem, as when the FTP connection is timed out, the file which is waiting to be uploaded is being used, and you try to overwrite it.
This happens because you're using ScoutApp or Compass, they block your SCSS files because they are checking for changes as you specified for a directory for those files.
I suggest you reading this:
http://aspirecode.com/how-to-add-sass-support-in-sublime-text/
Good luck!
On mac using a remote volume sometimes I experience this. The solution is to remove the temp file then save again and all fixed.
IE: if you are working on test.html then the temp file would be ._test.html
Remove ._test.html then save again.
For Mac-
Try changing the destination from 'Macintosh HD' to 'Documents' or any other folder.
Worked for me.
The plugin of Superlime solved this problem. It tries to save the file as root in SublimeText.
Reference Link: https://github.com/azubr/Superlime
Try switching your SublimeText process priority to higher level in process manager (it has to have higher priority than your scss compiling app, if you're using one).
It seems to have worked for me.
if it's not working after doing all suggestions, reinstall the program
On Mac I saved the file in Home directory and it gave me this alert, later when I re saved the file again this time in Document directory the file is working now. Using SublimeText 3.
I found this occurred when the folders are read-only. Right-click on the folders where your site is contained and see if read-only is selected in the properties.
Just open it as an administrator.
Because I want to edit anything and write as admin all the time, I set this program to always open as an administrator using "Configure Applications to Always Run as an Administrator".
Just got your file folder properties which you want to save and deselect to read only attribute.

Disable auto save of code in Visual Studio 2012

I am using Microsoft Visual Studio 2012 Pro for windows software development. Earlier I used to use VS 2008.
One option that I couldn't find (which was there in older version) is :
Before building -
-Do not save any changes
-Save all changes
-Prompt to save changes
The above was available in Tools->Options->Build & Run in older versions.
At times when I make temp changes in my code which I don't want to save it then that feature comes in handy.
Is there any way I can stop VS 2012 from saving my code before I build/run it.
Thank you,
Cheers,
GR
That feature was dropped in Visual Studio 2010. As far as I know it hasn't resurfaced in Visual Studio 2012.
Save All Files Before Build Gone in Visual Studio 2012?
The IDE prompts for saving on unsaved code or resources when you close the project.
With GIT or other source control you can run on command to save versions.
I actually like the program "Second Copy" which you can set up to save versions of your code (I save the last 15 versions of any changed file in the project). This is set up to run whenever a file changes, but you would not want it to save a new version every time you make a change while testing/debugging, preferring to only back up to the new version every time the file is SAVED either manually using the mouse/Shortcut keys or upon close of the IDE. That way you have true backup of code you are satisfied with.
I think having autosave is dangerous because it overworks the source control if you have one in place (either GIT or Second Copy or whatever) and if you don't you lose the ability to go back to a prior version should you stuff up the code or decide not to proceed with changes. Having the option, though, to have autosave (either at intervals or on "Run"/"Build") should still be there to please all users (but the default should be "off")
Of course on "Publish" all files are saved anyway (as they should be).
Give "Second Copy" consideration...http://www.secondcopy.com/ (I have no association with second copy, I have just used it for years and love it)

Can't save php.ini

I have PHP for FastCGI installed on Windows 7 through the Web Platform Installer. I need to edit php.ini to enable logging, but I'm not able to overwrite the existing file, apparently because something has it open and/or locked.
Stopping the server in IIS Manager doesn't help; stopping the Windows Process Activation Service and the World Wide Web Publishing Service doesn't help. phpinfo() confirms that I'm working with the correct file (C:\Program Files (x86)\PHP\php.ini). It's not marked as read only and I do have permissions for it. I'm out of ideas.
I had this problem and managed to work around it. You need to be running the editor (notepad or whatever) as an admin.
In Window Vista / Window 7, right click and choose "Run as Administrator".
Then open php.ini and edit it...
Another option is to copy the text of the file into a new file in a different location, make your changes, save the file as 'php.ini'. Then copy the new file across overwriting the old one. Explorer may handle the permissions differently.
I've had a similar problem, and I was working in windows 10 which doesn't use "run as administrator"
So this is what I did:
right click the problem file and go to properties
go to tab security
click edit, which should have a shield
select in names of groups: Users(computer specifics\Users)
in the square under it you can allow editing of the file
This causes it to allow you to edit the file for users and not run into the problem anymore. This also removes the problem in the future for this file so you can always edit it again by just opening the file in text editor.
Please note I am Dutch and that certain names are translated incorrectly.
You could use the Find Handle feature of Process Explorer (direct EXE download link), from Sysinternals (a part of Microsoft now), to find out what exactly is locking the file.
I'm sorry I can't help with your exact question, but hope that helps!
In Windows 7, right click Notepad and choose "Run as Administrator". Make sure you do not use Notepad++ as your editor. It accesses this file and therefore tells you there's is an error.
The default notepad will work fine with these instructions.
Depending on what are you trying to write to the file, you can write to an '.htaccess' file on the root of the site instead. I can provide a more specific example if you would like.
You can also use Unlocker to figure this out. A pain, but the utility is really handy anyway so it won't hurt to have it around.
1) Open CMD with administrator mostly like this.
2) Then go to "C:\Program Files\php-8.1.7" like this.
3) then paste "cd C:\Program Files\php-8.1.7" and press Enter and type
php.ini like this.
4) It will automatically open the file in a text editor or suggest to
open any editor like notepad , notepad++,vs code etc.
5) edit as you wish and save it like (ctrl + s) .Here I adding MongoDB
extension like this .And that's it.
By the way the question was asked 12 years ago but we still facing the problem
Try this:
Stop the webserver
Change the file
Start the webserver
If that doesn't work, then you are probably changing the wrong file. It's possible that the original file is elsewhere and when the server starts it copies it to C:\Program Files (x86)\PHP\php.ini. phpinfo() might be pointing to the file that is overwritten every time...

Resources