I'm studying computer science and working on a project.
Within my project, I made an ABSOLUTELY stupid mistake and deleted a line of code in the designer.cs, and now I have nearly 400 errors. Unfortunately for me, it ended up saving and closing which means I can't revert any changes made, I looked for backups but can't find any.
I have no idea what that line of code was, and I don't want to redo the entire project by copying and pasting. Any help if possible is much appreciated! I hope I explained it enough
The missing line is the first one after initialize component
Edit: Errors list
You removed your system refrence, Add it back by right click References -> Add Reference
Under Assemblies , search for System
Based on errors in the screenshot, I think you simply need to add using System; to the top of the file.
Related
I try to add service references on ASP.NET Core Web App. That results app reference.cs file is mostly missing, classes are empty etc and only 100 lines.
But -even in same solution- if i try to add the same service reference in windows form app, all methods, interfaces and classes
are completely correct.
If i try to add web references in ASP.NET, theres no missing but i need to use WCF.
I try to copy other references file and paste it but it wont work.
What did i miss?
Note: I already check this answer and subject but it will not work first time and question isnt same. My reference.cs file isnt empty,and also theres no change even i try 100 time it will be the same output - this question pointed coincidence - so it is NOT duplicate question. Thanks.
After 5-6 hours thanks to this beautiful answer - actually i tried this before - and with my add ons, i figure it out.
Delete the reference - right click and delete -
Check file explorer, make sure no files in Connected Services.
While your project is highlighted, right click on project and select clean
After all of that, add your service reference and -just like the answer said- make sure reuse types in referenced assembles is not checked.
I'm struggling with some code using LibreOffice 7.1.0 on Windows 10 to append images from a folder into separate slides in Impress. I've been looking here and OpenOffice documentation. This call continuously fails (null): xMultiServiceFactory.createInstance("com.sun.star.drawing.BitmapTable"); and I cannot understand why? I tried using XMultiComponentFactory also, but no luck. Has it got something to do with Slide Layout, but despite being of blank type, I could drag-drop an image and it gets added in the slide.
Unfortunately, full code is on restricted system, so I have this much only. Any hints on potential causes would be very helpful.
It was simple issue: I needed to initialize xMultiServiceFactory with xComponent. I had earlier initialized it with xComponentContext.getServiceManager(). I realize again, this is why learning object model is very important. COM could get tricky unless, one knew what they were doing.
When I write C#, I sometimes have 3-4 missing usings which I can add with the tooltip window -> add missing using, or doing ctrl + . On the line where a missing using is present.
Doing this 3-4 times is rather annoying.
I have noticed a "add all missing usings" tooltip sometimes, which worked, but I can not get it to pop up reliably.
I know resharper has it, but I don't want to use a paid extension for this feature.
How can I reliably get this "add all missing usings" pop up, or in what other way can I add all missing usings at once?
Thanks!
The "add missing usings" is triggered by a paste action. After you paste new code, the option will be available so long as you haven't made any edits to the document after pasting the code (making any edit removes the option). Also, the option doesn't add missing usings for the rest of the document -it only analyzes the pasted section-.
You can cut out your code and then paste it to trigger the action as unfortunately currently it is not part of the default Quick Actions refactorings.
To complete #rhytonix answer...
after pasting your code, you have to click on the screwdriver in the left margin like this:
Also, have a look at the free Auto-Using for C#.
While I am not a huge fan of this, it might alleviate the pain of continually having to stop writing code to add a using statement. You can also view the project here on GitHub.
Personally, I just use Ctrl+. like you mentioned which fits in nicely with my way of writing code.
I use both Delphi and Visual Studio (C#), and I've noticed a difference in how code-completion works which I find really annoying. In Delphi, if you edit existing code so that you change the variable you're using, code completion will give hints based on the code before your cursor. For instance, inserting an "I" into myString to become myIString would give a code hint to show any available variables starting with "myI". Selecting one will then overwrite myString with the new one.
In Visual Studio doing the same thing brings up a code-completion menu with all available variables, and none selected so you see the top of the list. You have to completely delete the variable you're using and start again before you get meaningful code completion.
I seem to make changes like this quite often (maybe I should just get it right in the first place!) so it gets a bit annoying having to remove code, and can be trickier on longer lines with lots of parts to them.
Here's some screenshots which (hopefully) illustrate the difference. I was struggling how best to word this!
Code completion in Delphi
Code completion in Visual Studio
I've tried playing with the Intellisense settings in Visual Studio and there's nothing there which seems to change the behaviour. Is there any way of replicating it in C#?
I've tried playing with the Intellisense settings in Visual Studio and
there's nothing there which seems to change the behaviour. Is there
any way of replicating it in C#?
For now, VS doesn't support for this behavior. The auto completion won't work when we insert a character into existing variable. It will take effect when we type a character in a empty place.
Type character in a new place, the intellisense works.
Insert character,the intellisense not works.
In my opinion your suggestions is really meaningful. I think it could be better if we have a new option to support for auto-completion when insert character, so I suggest you can Go=>Help=>Seed Feedback=>Provide a suggestion to post your idea there.
We who interested in it will vote for you if you share the link here.
As alternative ways:
You can go Tools=>Options=>Text Editor=>C#=>Intellisense=>Enable Show Completion list after a character is deleted option.
Then you can insert 'i', the statement could be myiSring1.GetType(); And delete any or all characters in the String1,it would show the intellisense like below:(e.g:I delete 'r'.) Apparently, this is what you really want, but as I mentioned above, VS itself doesn't support this behavior for now, hope you can use 'delete option' saves some time. Sorry for the inconvenience.
Also, you can check if ReSharper can meet your needs,since it's a third-party tool which seems to charge after xx-days trial, I have no further details for it.
Hope all above helps :)
I'm working on an application on VS2013 and have this bug right now which is every time I add an SQL query I have a new Designer.cs file created, which is called Designer1.cs. Then of course impossible to run the app cause there are conflicts between the 2 files.
Does anyone know why it's doing this and how to fix it? I can't work on my application anymore because of that.
I've read some posts about it, done the trick but still got some new Designer1.cs file being created after that.
Weird “Designer1.cs” files created
Dataset Designer.cs generate Designer1.cs after taking update from SVN in VS2013
I suspect something is wrong with my project settings but really don't know how to fix it. Is it possible to copy all the content of the application to a new project easily? I'm using VS2013 for school and don't know much about it, some help would be really appreciated, thank you!
I have had the same in three projects. Sometimes deleting the .sln-file helps, sometimes it is neccessary to copy all files to a new created project, excluding the sln-file.
I don't know why this bug comes up, I looked for help but nothing to find. I wrote to Microsofts develloper forum - no answer.
The description in your first link - the answer of zendar - is very good for the first time. The excluding is not nessecary, but deleting .designer1.cs after renaming in the explorer is reqired.