Today I opened my project and saw this error, I can't open my designer for this error. I clicked on (ignore and continue) but it shows an empty form. What can I do?
From the error message it seems the Form1.Designer.resx is broken.
The file has an XML file layout so it would be quite easy to spot missing closed tags, etc. The file can store images used too so it can get quite large.
If you really can't rescue it, you could delete it. Often most information is already in the Form1.Designer.cs file.
Related
I have some xml code that i like to have pretty printed (but is not parsable by tools like XmlDocument etc.) in a browser. I currently write the xml code to a file with
File.WriteAllText(filepath, xmlCode);
When i then open the .xml file in file explorer, I get an error that is can't be parsed. No matter if i open it via code or via file explorer.
However when i copy the exact same message into windows text editor and save it as .xml, it is pretty printed regardless of the browser I open it with. This applies to opening it by code and file explorer.
Does c# or editor add some hidden attributes to the file that is not visible to me (but can be manipulated) which could explain this behaviour?
A colleague of mine said it could have something to do with NTFS streams but I know too little about them.
Thanks for the responses!
It turned out to be more simple than encoding issues and more of a problem of how it was formatted before getting to my end.
Someone must have done:
message.Replace(" ", string.empty);
Which resulted in the xmlns:i part being put together with the attribute name (I belive this is called differently but I don't know the proper name), as such
<AttributeNamexmlns:i="....
My solution:
It still is not parcalable for a XmlDocument or similar for some reason (but that is not necessary for me, as long as it is pretty printed), so my current solution is to open it in a browser (specifically a WebBrowser in Windows Forms, but this should work with a "local" browser too):
First I get rid of the spacing mistake (yes this should be done at an earlier stage in the process, this is just temporary):
var index = msg.IndexOf("xmlns:i");
msg = msg.Insert(index, " ");
Then write it to a file and open it in my custom browser (which is nothing more than a WebBrowser in a form - with nothing modified):
CustomBrowser cb = new CustomBrowser();
cb.Show();
cb.Navigate(filePath);
This then pretty prints the xml doc and displays it. (Thats all I need for my use case)
**Hello, my Visual C# is running but when I enter a person's name in Form1.cs[Design] it won't open the file. My code is below and I'll also attach how I saved my txt and what errors are showing. I been trying to figure this out for hours. My goal is to learn how to save txt in my directory folder and how to call it in the .cs code.
`` ```
Errors
enter image description here
tldr;
Your filename is 'BoysNames.txt.txt'.
From the image it is clear that the exception occured, because there is no file called 'BoysNames.txt' in the current directory. I see what the problem is. You have hidden the extension of files and still the text file is displayed with its extension. (Note that since the 'exe' file doesn't show its extension but 'txt' is showing. It means it has double extensions). So, you need to do this:
boysFile = File.OpenText('D:\\visual c#\\pp22\\bin\\Debug\\BoysNames.txt.txt');
To avoid this type of problems in the future, try these steps.
Go to Control Panel.
Click on File Explorer Options -> View
Uncheck this Option 'Hide extensiobns for known file types'
Well it looks like it will not open the file because it is not where you are saying it is. Look in the error, it tells you where it is looking for the file, is it really there?
I have an mvc project while working on it i have opened a cshtml file, then unexpectedly my pc was crashed and restarted, now when i want to open the same cshtml file it opens like the image i have shared
when i open the url in the browser i get this error as bellow image
any help please
I'm not sure what your question is, since you only describe a problem and not specifically what you are trying to do.
But since it's been 20 minutes and nobody is answering, I'll try to help. (I do not have enough reputation to post a comment, or I would have)
The screen in your sample is Visual Studio's binary editor. Your file seems to contain only zeroes, no data. That probably means the file is corrupt. I assume Visual Studio defaults to the binary editor in this case because the file does not contain any text that is possible to display.
I think you'll have to delete the file and restore it from your source control system. (Hopefully you didn't have a lot of work in that file, because it is probably gone.)
Good morning,
I'm a newbie to posting issues on the site; I always find the answers without problem. This one, however, is persistent and I can't seem to find an answer anywhere. This is a spontaneous issue and doesn't affect all users.
The following error appears:
"Loading custom dictionary file at C:\Users\Someuser\AppData\Local\Temp\tmpfile.tmp failed."
Here is the code that I use to add the custom dictionary file to the textbox upon initialization.
IList<Uri> dict = (IList<Uri>)SpellCheck.CustomDictionaries;
dict.Add(new Uri("pack://application:,,,/Resources/ResourceDictionary/medicalDictionarySpellCheck.lex"));
I cleared temp directories thinking that there was some kind of space limitation that was blocking the creation of a temp file necessary in the process. It didn't slow the error down.
This mostly happens in the afternoon after the program has been in use for several hours. One thing I did notice is that the users have a screen capturing program that does fill up the temp directory, but this error appears even with almost no files in the folder.
Any ideas?
I want to know what this form1.resx button is all about. I read up this thread and got to know more about the Program.cs(main() file), form1.cs(logical code) and form1.Designer.cs(UI related code) but not the form1.resx file. Is there any harm if I delete it. What is the purpose of the form1.resx file ??
Many Thanks
My suggestion is to open the file in a text editor - preferable with XML highlighting. You will see a very well commented XML file with information about the form's resources. My understanding is that if you delete the file, external resources associated with the form will be lost.