SOME Breakpoints not hitting in VS2012 / C# - c#

I have somewhat a bizarre problem here. I have a Solution developed with VS2012 in C#. I have 6 Projects in the solution. My problem is, with some of the projects in the solution, no code change has any affect on Solution Build. It's not just new code, not even Breakpoints are getting hit!!
I have done a thorough research in the net, couldn't find anything helpful.
And of course, I have tried
re-compiling
deleting all the binaries and compiling again
checked solution properties numerous times
etc...So, I think I have tried all the basics, but couldn't find a way out.
I gathered some screenshots, but I noticed I need at least 10 reps so I can't post them yet :(.
Any help at all will be greatly appreciated
Cihan Esen
EDIT: After the responses, I see that I have add, two other guys in my team is working on the same code, same build environment. They are not having this problem. I cross-checked every single configuration in their system which could remotely relate with this, we definitely have the same settings in VS.
And yes, I build the solution in DEBUG mode, not RELEASE.
I have tried seperate clean + build for the problematic projects -> no difference.
EDIT 2: I have to add; I have modified the code in the problematic project, so that I would see completely different output, but it didn't work. I mean that project/class of the solution, is still producing the same result, as if the code has not been changed at all. And yes, I have deleted all the binaries, saw them being built again.
This sounds really stupid to me but VS is acting as if it has a version of my source code of this problematic Project/Class, and it always compiles that version.

Make sure you are running in dubug mode and try this:
Go to your solution folder.
Show hidden files
Close your solution Delete .sou file for solution.
Add your break points, build your soltion and try.

throw away the obj and bin folders
throw away your .suo files
perform IIS reset for webapplications
rebuild everything.
should do the trick :)

Related

VS Code intellisence not working after migrating project to another Repo

I've started programming on a c# compiler a while ago, and since then switched from azure devops to github in my normal programming routine.
So when I picked up work again, I started committing to azure again, and found it really inconvenient to just have one project to another devops soulution so I decided to import this repo to github as well.
This was a day ago.
The previous days I've worked a lot in code and intellisense was working nicely, just until I imported the program to github, deleted the project folder on my pc and pulled the repo off of Github. I now this probably is not the most convenient way of doing this, but that's what I did.
Now intellisense completely stopped working.
Normaly ctrl+. should give me a huge list of things I could do, but it always says that there are no code actions available. Even the red squiggles don't appear until I try to run the project which makes it very hard to write code effectively as I often have loose ands I thought I fixed already.
So far I have tried reinstalling intellisense, the C# language extension and "re-pulling" the entire project, if that is an adequate term.
Of course I tried turning on and off my computer as well, but this mysteriously did not solve my problem.
My question now is how I can fix this, if there is a way to reset intellisense in a way or if it's even possible to "destroy Intellisense for a project" as this seems pretty dumb. The solution probaly is easy and right in front of my eyes but I'm not able to see it.
Of course I looked at similar questions on Stack overflow but the suggested tips did not work either.

References not updating properly in Visual Studio

I am working on a rather large project in visual studio, and I have several references to other solutions and projects within my current solution. One of my user controls resides in a separate solution, so I need to consistently be able to update the DLL to fit any changes to my code. The only problem is, Visual Studio will not update my references unless I go through a long, meticulous process which I will try to describe now:
First, I must clean and rebuild the solution that contains the changed code. Here is a snippet of the class I need to update:
I just added the highlighted property, so my other project does not recognize it yet. I used blank properties like HelloWorld and ISuddenlyDespiseYogurt because they are easy to spot in code and properties will show in the compiled version of the code.
Secondly, I must go to the project I am trying to use the DLL in, delete the reference, and re add it.
I right click on the reference I want, click delete, then right click on the "References" tab, press "Add Reference", then I use the file path of my other solution and update the reference.
Lastly, I must restart Visual Studio and reopen the project I was working on.
And now our new property is recognized by my project. This solution works every time, but it is a ridiculously annoying workaround, and I am hoping someone out there knows how to make this process much easier.
This is the closest thing I can find to a similar problem on StackOverflow, and the rest of the internet is no help. If anyone has any clue how to fix this problem, I would very much appreciate your insight.
I have a feeling that your project is copying the library .DLL to your project folder, instead of linking over to the Hamilton.HST project's Release folder.
Two things I would check from your side: when you're linking the reference and clicking 'Browse', where exactly are you grabbing the .DLL from? Hopefully the Release folder, or some other output that changes when the Hamilton.HST project is recompiled. And second, check your main project and the properties on the Reference, to make sure it's pointed to that Hamilton.HST folder (like I said, I have a suspicion its pointing to somewhere in your second project's folder, and that VS copied the DLL over instead of linking.)
I managed to fix the problem, hopefully for good. For the sake of anyone else who may have this problem, here is my solution:
I went into the "Properties" tab of my project, by right clicking on the project name in Solution Explorer and clicking "Properties". I then navigated to "Build Events", where I saw something like this:
The first two lines were there when I opened the window, and I added the last line. From what I can gather, the addition of that line tells my program where to look for updated DLL's upon building the project, and I had the wrong location before.
Other than that, I have no idea how this solution worked, but hopefully it can work for someone else. If anyone knows the logic behind this solution, please let me know so I can clarify my answer. Thanks to everyone who gave me suggestions to fix this!
Visual Studio 2019. The error was misleading in my case. After building one project at a time, I ran into the actual build error in one of the projects, which prevented that project from compiling and therefore caused the missing dll error. Once the issue was resolved, everything built properly.

Solution fails to build w/ missing auto-generated .g.cs file for the first time, succeeds on second build

I'm building a WPF app w/ Visual Studio 2015 (Update 3), and—at least by now, I'm not sure for how long this has been the case—every time I make a change and compile, I'll get a failed build w/ the error
6>CSC : error CS2001: Source file 'C:[...]\Obj\Debug\AnyCPU\GeneratedInternalTypeHelper.g.cs' could not be found.`
If I just build a second time, though, it works just fine.
This smells to me like a dependency on another file that is generated afterwards or something like that, but I haven't been able to find out what it is, a google search didn't net anything either, and neither did a search through my project what this file is used for in the first place (the name suggests its purpose, but I don't know where exactly it is used).
It might also be that the (group-policy-mandated) Anti-Virus is holding an exclusive lock on the file or its dependency for a moment too long, and VS stumbles over that, I think I remember a problem like this at my last job, but I'm not sure that is the case (and I can't simply disable the scanner for a check, it's completely locked down and I don't want to violate company policy for trying to circumvent it).
Any ideas? It's not critical since it's easy to work around, but it's annoying and I don't really want to check in the project like this in the end.
I had the same issue and i found why it happened (in my case).
Every project of our solution has the same output folder.
The file GeneratedInternalTypeHelper.g.cs was generated at the same place for each project.
The build order/dependencies were computed and Visual Studio found that some project could be build in parallel.
In Tools > Options > Project & Solutions > Build and Run you can find the option "Maximum number of parallel project builds.
After changed from 8(in my case) to 1, no more files generated at the same time :)
It is a little slower to compile but really less annoying than compile multiple times... \o/
An alternative solution is to add project dependencies in the solution for the projects you don't want to build in parallel.
With this you can keep the parallel project build for the other projects.
I have just chased down the same error. In my case it was caused by Git checkout inserting a "%20" into the folder name of the solution where a space was expected. Replacing "%20" with space fixed all these missing *.g.cs errors. Thought worth mentioning here.

VS2015 class not building .dll

This is essentially identical to Class Library Project File not compiling into .dll or debugging, but that item was from 2009 and should be closed and inactive by now.
I, too, have a class solution/project that should be producing a .dll on successful build and isn't.
I have followed all instructions in the previously referenced stack overflow item to no avail. It doesn't matter if I clean the build, build debug or release versions. There are no errors, no warnings, and no messages whatsoever.
The Build always succeeds. If I do a Clean it always succeeds.
The Output path is correct.
How do I get around this issue and get output from the Build?
I'm pretty much at my wits end. Any thoughts or suggestions? This is VS 2015, version 14.0.25431.01 Update 3 running on Windows 10 Pro.
Thanks in advance for any suggestions.
Ok, so I'm a screw-up! Sometimes you have to get frustrated to find the real problem...
If you have this problem, one suggestion would be to verify that you really loaded the solution/project from the location on the (a) hard drive that corresponds to the one you are trying to reference in another solution. Be careful when doing so, sometimes those "Recent" solutions aren't really what you think they are.
Sorry to clog space up with such a stupid issue. It's getting late; I must be getting a little tired.

C# debugging across dlls

I have a project which has a calling structure similar to this:
main project/application
my library code
someone else's library code
my library code
Everything's written in C#, and I have access to 'someone else's library code'. Their code is not included in my project, because it's open source and not my code. I can make debug versions of all the libraries, and I've done so.
That 'someone else's library code (SELC, I guess?) is throwing an exception in a heisen-bug kind of way, and I'm trying to track it down and maybe submit a bugfix to the project maintainer. Problem is, my debugging stack is stopping at my library code, and lists the SELC as 'external' and I can't debug into it. I've copied the pdb files as well as the debug version of the library into the debug directory of my application, and still no luck; I can't seem to debug into their code, and I can't step into it at all.
Once upon a time, back in vs6 days, I could do this-- have two different projects open at the same time in two different environments, and have the debugger trace across dll boundaries from one project into another. I'd assume that functionality remains, because it's just so dang useful.
Any suggestions?
I've looked for this answer but not found it, so if this is a dupe, just let me know where to look.
Do you have "Just My Code" turned on in Visual Studio's debugging options?
If you have the sources (as i read from you), you can make an project with their source code, and then add the project to your solution.
In visual studio the project in .csproj file , and solutions in .sln file.

Categories