IDEA no longer compiling project before run - maven

I loaded a Maven project in IDEA 2018.1.5. I configured an "Application" run/debug configuration to run it.
I could have sworn that in the past, IDEA would automatically invoke "Build Project" before Run/Debug if any source files had changed. Then something happened recently, and it no longer does. Now, every time I run/debug the project, it runs the compiled code even if it's stale (ignoring changes I made to the source-code).
I checked Settings -> Compiler -> "Build project automatically" is on. I think I tried disabling it at one point and I did not notice a difference. What other setting could be causing this behavior?

Edit run configurations, select the good one, make sure "Build" is present in the "Before launch" at the bottom of the dialog box.

Related

Visual Studio 2015 no longer generates executable

I had a Windows Forms application that needed some UI and code changes changes made to it. I made the proper changes (mainly deleting a few controls and moving some code). Oddly after the changes were made, I would rebuild run, and despite the changes, the changes being saved, and builds being made multiple times,the application would always run as if the changes were never made.
I tried to Build -> Clean Solution a few times, with no avail. I decided to try manually deleting the bin and obj folders and rebuild. However, after closing the solution, deleting those folders, I tried to build again and get the following error:
OutputPath and AssemblyName are set correctly as far as I'm aware. This only affects Debug, Release runs fine (sort of) and even in debug XML and *.vshost files are created, but not the executable. I've tried restarting VS a few times to no avail. What in the world did I do and how do I fix it?
EDIT After right clicking on the solution and doing a batch-build on all projects in the solution, things started working. I still have no idea what happened, so if anyone has any theories feel free to comment.
Does the Output window provide any details about where the .exe was created?
You may need to increase the verbosity of the logging. To do so, go to the Options dialog (Tools > Options) and open "Projects and Solutions" > "Build and Run." Change the "MSBuild project build output verbosity" and recompile.

Intellij IDEA Alternate source while debugging

Env:
Mac OS
IDEA Community Edition 15
Hi,
I am currently facing two issues while remote debugging. Googled around but haven't been able to fix'em.
Despite the source code being available within the project, the
debugger always stops in the maven sources. Question : Is there a
setting/workaround that boils down to "Prefer project modules over maven sources while debugging" ?
Idea showed a popup showing the alternate sources initially. After selecting local module i disabled it. Now i can not re-enable it (for other local modules). The intended behaviour was that it automatically goes to local module source but that not working. Not irritating enough, Preferences -> Build -> Debugger -> "Show alternate source switcher" is not working. It always keeps disabled no matter what i do.
Any inputs are much appreciated.
Rakesh
Update
Solution for #2 is to do it the hard way. Open up
/Users/user-name-here/Library/Preferences/IdeaIC15/options/other.xml
and set 'SHOW_ALTERNATIVE_SOURCE' to true i.e.
<option name="SHOW_ALTERNATIVE_SOURCE" value="true" />
and restart IDEA
Even I had the same problem. I had external jars files attached in the Project_Structure -> Modules -> Dependencies. I did the following trick, it worked for me and it is not the remote debugging. I attached the source code of those jar files in Project_Structure -> Libraries and click the + in the second window pane (I am using Intellij Idea Ultimate 2018.2) then java option in the drop-down list. After selecting java option, a file browser window will open up, choose the source code directory you want to attach during the debugging.

Can't switch from release to debug configuration in Visual Studio 2010

I downloaded an ASP.NET open source solution and opened it in Visual Studio 2010. VS is running as admin.
Everytime I switch the solution or a project from Active (Release) to Debug and uncheck 'Optimize code' and save, these changes don't stick. The solution or project reverts back to Active (Release).
Why is this happening?
You also have to change it in Configuration-Manager (see pictures).
I just had this exact issue. The solution ended up being:
Go to Tools ⇒ Options ⇒ Make sure "Show All Settings" in the lower left is checked.
Then, in that same window, go to Projects and Solutions ⇒ General ⇒ check "Show advanced build configurations".
I have no idea why this checkbox was suddenly unchecked for me this morning, but this worked.
This is guessing a little, but anyways:
Most likely, you are using build configurations that don't include your start up project for Debug build.
Look for the 'Manage Build Configurations' (I think, no Windows machine nearby) menu item. It will show you a list of projects with tickboxes on the right to show whether it is to be built in the build configuration.
Switch to 'Debug' in that dialog and make sure your startup project - or the project that your starting the build for - is actually included in the build.
PS It is even entirely possible that the 'misbehaving' project is actually lacking a Debug build (it might have a deviant name, like DebugConsole or something else entirely). In that case, use the Project menu to add a build configuration of the proper name for that single project. Afterwards, check (again) that said build configurations are checked in the 'solution wide' build configuration dialog.
HTH
Changing the properties of a configuration doesn't change the current build configuration. If you open project properties, change from Release to Debug and make some changes, after exiting the dialog, you will build on the same platform as before. To change the platform you're building on, there is a combo-box right above the code - use that. You should have all available configurations in the list. When you open the project preferences dialog, the current configuration will be the default one in the dialog.
I opened the csproj file in a text editor. Noticed there were two PropertyGroup sections which look like duplicates, one was Debug|AnyCPU and the second was Release|AnyCPU. I deleted the second one and the debug one showed up.
Luchian Grigore's answer explains correctly one simple misconception that could lead to this problem and aaaaaaa's answer gives another way of correcting it: there is a dialog that looks like you are selecting the configuration to build but you are actually just selecting the configuration to configure.
However neither of their ways of opening the 'Configuration Manager' actually worked for me -- I had to click on the button configuration manager at the top right of the solution Properties.
(Note that the place where you choose the configuration is called Configuration Manager, whereas the place where you manage the configurations is Properties.)

This Breakpoint Will Not Currently Be Hit, The Source Code is Different from the Original (even after cleaning/rebuilding)

.NET 4, console application. The project is set to 'Debug' mode. The breakpoint being set is in the primary/startup project. I have right-clicked -> Clean, and right-clicked -> rebuild, both on the Solution and project levels.
Following the instructions in this SO question, I have confirmed that my "Build and Run" options are set to 'prompt' for both 'When projects are out of date' and 'when build or deployment errors occur', and I am NOT getting a prompt when I F5 to build/run.
Also, the 'save all changes' under 'before building' is also selected (plus I manually saved them myself).
I monitored the output window of the application, see this line:
'MyApplication.exe': (Managed (v4.0.30319)): Loaded 'C:\exepath' Symbols Loaded.
I restarted the VS2010 instance. I restarted all open VS2010 instances (of other projects). I've even gone through a reboot.
However, the breakpoint I am setting in the startup project is a hollow-red circle, with the notice that 'This breakpoint will not currently be hit, The source code is different from the original', and, in fact, is never hit.
So, this is really 2 questions:
1) How do I fix this problem so I can properly breakpoint
2) When I see this, does that mean my code is executing from an older build?
I've had this problem once myself but that was on a vsto addin. In that case there were left over intermediate files under the users/appdata directories that were actually loaded instead of my app.
There is this blog article that has a whole load of possible reasons for this error and then a whole bunch more in the comments from other users
This can also happen if you have a solution with multiple projects, and have the wrong project selected as your startup project in VS2010 and VS2012.
Now, obviously, I wouldn't expect debugging to work if I have the wrong startup project selected -- the debugger is attaching itself to the wrong process!
But this error message (in my case) was terribly misleading. It made me think something else was wrong. I tried a bunch of solutions in this thread (nuking various /bin and output directories) when really it was something very simple (wrong startup process).
If you are using vb, check that you are building the project for the active solution configuration (Build, Configuration Manager..., Column under Build is checked. Also check the project properties, Compile tab, Advanced Compile Options, and Generate debug info is set to Full. Sorry I can't tell you where this may be in C#.
The only other time I've seen this is when two projects in the solution are referencing the same dll but they are referencing from different sources. One from a project reference and another from a file reference for example. If the "copy local" option is true, there would be the potential of overwriting the dll with an older version of the same dll.
My solution might help people who have signed the assembly.
After lot of head scratching for the past two days, I was able to resolve the same issue by doing the following simple steps:
Go to your Visual Studio project properties.
Go to the "Signing" tab.
Uncheck "Delay sign only" option if it is checked.
Now run your project and it should work.For me it did work.
In my case was this same problem (“The breakpoint will not currently be hit. The source code is different from the original version.”) caused by fact, that I tried add breakpoint to declaration:
DateTime dt;
bool b = DateTime.TryParse(null, out dt);
(first line of code)
So I assume that message is "universal" and may have many different causes.
This can happen if your system clock was changed since the last compile. Your PDB file will be different date than the one your are trying to debug. Delete the PDB files in the project and recompile.
I experienced the problem when Project > Properties > Web did not have "Enable Edit and Continue" selected. After enabling this feature the issue was corrected.
It is important to note that under Tools > Options > Debugging > Edit and Continue "Enable Edit and Continue" was selected, but it was not enabled for this project.
Just go to Tools / Import and Export Settings
Choose reset all settings then click Next
No, just resetl settings, ovewriting my current settings then click next
Choose your current language, por example C#. then click Finish
If you have multiple solutions open, try simply closing all Visual Studio instances and restarting only the instance you need.
In my experience this has happened when two branches of nearly identical code are open in different instances.
doing a "clean solution" from VS Build Menu might help you.
I had to go over all those steps to fix the issue on my computer.
Make sure that debug = "true" on your web.config
Clean and rebuild all projects
Delete every file inside the bin folder of all projects
Close and open Visual Studio, rebuild, and run the project again.
Go to your solution folder -> obj -> Debug - > delete the .dll file and build the solution again.

How to set breakpoint in a dependent xcode project

i have a XCode project (my main xcode project which has its executable). It has dependencies on a few other projects (under the Project tab in Detail View, there are a few other xcode project that it depends on).
My question is how can I setup breakpoint in the code of the dependent project?
I tried this, but this does not work
1. open my main xcode project
2. double click one of the dependent xcode project
3. in the source directory, find the file I want to break and add a breakpoint (by click at the side of the border of the editor, a blue 'bookmark thing' shows up)
4. Go back to 'Build and Go', my application does run but it never breaks at the break point I set in #3.
Can someone please help me? I have spent days on this, I can't figure it why.
Thank you.
1) Add the breakpoint in your project
2) Go into breakpoints view in xcode (top left besides project navigator) The view's icon is like a breakpoint icon
3) Right click on the required breakpoint and select "Move to" -> "User"
If the breakpoint is under "User" project, then it is accessible by all projects.
Whenever I've had trouble setting breakpoints with the Xcode GUI, I've managed to do it with the debugger command line (that is to say, the "lldb" prompt in the output window). For example, to set a breakpoint in source file "client.m" at line 42, type:
(lldb) b client.m:42
Besides being a fix for this particular problem, debugging on the command-line offers far more flexibility and automatability than any GUI could. A good place to start would be the LLDB tutorial. (Full disclosure: I'm a longtime fan of unix and gdb, so there's some bias here).
Of course, as others have mentioned, make sure the library/dependant project is compiled with debug symbols. Hope this helps; good luck.
I'll echo Jon-Eric here and also add that if you habitually run your project with Cmd+Enter, you should consider switching to Cmd+Y to enable gdb each time.
a few things here...(some obvious some not)
1) be sure that the dependant project is compiled with debug symbols (i'm assuming its a library)
2) be sure that your active executable is linking against the debug version of your dependent library
3) set a breakpoint in your main project just before calling into the entry point of your lib, and set a bp on the entry-point of the lib... (in addition to the real breakpoint you are looking to hit...)
I have found that the best way to debug a library is to open the lib project and set the active executable to be the main project, and then just hit "build and debug" directly from the library project.
I hope this helps, good luck, and have fun!
I've had similar problems with Xcode. The solution for me is to make sure that there is also a breakpoint in the main project that gets hit (as Kent mentions in his third point). I don't understand why this works though.
You should also only set breakpoints in a project when you've got it open. If you don't, they can start misbehaving: still stopping the flow of execution after you've disabled or deleted them, or not working when you think they're enabled.
Make sure you select 'Build and Debug' (for step #4). 'Go' sometimes means 'Run' (breakpoints disabled) and sometimes means 'Debug' (breakpoints enabled).
Also, make sure that you leave the dependent project open while you debug the main project.
In addition to kent reply about debug symbols, check COPY_PHASE_STRIP value in the build settings of the main project, and be sure it is set to NO in debug.

Resources