QtCreator weired bug - qt-creator

I experienced a really annoying qtcreator bug, I don't know if I get something wrong or is just a known bug and have some simple solution (I really hope so).
BUG: when I try to generate the missing members of a Q_PROPERTY using alt+Enter, the generate members are created randomly. Same bug is found when I try to generate setters and getters.
INFO: QtCreator 4.2 QT 5.7.1 MSVC 2015 32bits.
Here joined some screenshot of my qt creator
http://imgur.com/a/8ZUjq

I think I know what cause this bug. it's the missing public section.
You can reproduce the bug by creating a class without the public section
class Foo: public QObject {
Q_OBJECT
Q_PROPERTY(int c READ c WRITE setC NOTIFY cChanged)
Q_PROPERTY(int d READ d WRITE setD NOTIFY dChanged)
}
put the cursor on the Q_PROPERTY and hit Alt+Enter and click generate missing.
When I add the public section to the class everything works as expected.
Maybe this should be corrected in the next qt-creator release, I guess it should add the public section automatically and insert the correct members.

Related

Visual Studio - disable stepping into source code of module (Shouldly)

I am using a an assertion framework called Shouldly for C#.
The code looks like this:
[Fact]
public void SimpleTest()
{
false.ShouldBe(true);
}
This is the same as:
[Fact]
public void SimpleTest()
{
Assert.True(false);
}
However, when I debug the example that uses Shouldly, this happens:
But I want this to happen:
The issue
When I debug with Shouldly, Visual Studio steps into the source code of the Shouldly package. I don't want to see the internals, I just want to see what line of the test my code broke on. I can use the Stack Trace to find what line my code broke on but this slows down my flow a lot.
I remember when I first started debugging with Shouldly, VS asked me if it should download the source files (.pdb?) of Shouldly to debug with, I think I accidentally told it yes.
If I look at the Modules I have loaded in VS, it shows me this:
It thinks Shouldly is "User Code" which is probably why it debugs into this. How can I disable this?
I have this issue every time I change VS version. I've managed to fix it before but this time I can't figure it out.
You can disable symbol loading for a loaded module by:
opening the Module window
searching for the module you want to change
right clicking on it and disabling Always Load Automatically

Strange behaviour with Xcode 4.3

I have a lot of classes on my project, my Source Editor displays the class names, iVar names ect correctly in all the class except one. In one of my classes all the input(mean, code) is displayed in white font and none of the class methods work. For example i have declared properties for NSMutableArray but i can't get the class method objectAtIndex:.. What can i do can anyone help please?
Go to Menue->Product-Clean and clean your project.
Delete your app in simulator, restart xcode,
restart operating system, check your project so you have no errors in your class,
and finally compile it again.
Sometimes i am getting this same behaviour, too. Dont know why.
Is the whole class without syntax highlighting? If no, check at the point where the syntax highlight ends, there could be a syntax error or something different.
Hope it helps.
Restart your Xcode.It may be helpful
There must be an error somewhere in your code. Unfortunately, sometimes xcode cannot show errors properly. As for me, somtimes I can't see errors at all.
If restart don't work for you. Try repairing permissions in Disk Utility (that worked for me).

Track issue-related comments like "// fixes #123" in Visual Studio, similar to task list

We use an issue tracker (Redmine) for our software tasks/bugs and often mark the fixes/implementations with a comment like this:
// fixes #1234: changed this and that
Or we also mark code locations which cause a certain bug like this:
// causes #2345
Now, I am looking for a tool which can automatically track those issue-related comments in all files in the current solution and present them in a list or tree. This is similar to the task list which scans the files for comments with // TODO or // HACK. Unfortunately, it is not possible to define a new task category with just # as identifier because this character is not allowed.
Does anyone know of such a functionality, addon, or tool for VS2010 or VS2008?
This is generally a feature provided by whatever issue tracking software you use rather than a function of Visual Studio. Codebase HQ for example scans code (on commit) for speciially formatted comments that it is configured to recognise and groups the code change/commit to the record of the issue. It's web-based.
Axosoft OnTime provide a plugin for Visual Studio which allow you to work with your issues directly within the IDE.
See: http://www.axosoft.com/ontime/visual_studio_plugin
Failing that, if you only want to track bug causes between commits while you're working, then the inbuild tracker might be of use after all...
Add a tag to track with to Visual Studios configuration (I've added the CausesBug token)...
Then add the token in amongst your code:
public override bool IsApproved {
get
{
// CausesBug: 1234
return this.IsEnabled;
}
set { this.IsEnabled = value; }
}
Then each item gets listed in the Task List, displaying location in source, until you can ammend, and then say you fixed the issue in your commit, in turn getting picked up by your issue tracker.

Why does Debug.Writeline stop working for some projects in the solution?

We have a solution with multiple projects after running the code from VS the output normally seen from Debug.Writeline statements just cease to appear. I mention the multiple projects because the output from one of the projects continues to appear. However, the other project consistently stops showing the output from the statements.
It's starting to drive me crazy. I should mention this is also occurring for a second developer on the project. Anyone seen this before, or have any ideas?
After being tormented by this for years I finally found the cause and the solution in this Stack Overflow question: vs2010 Debug.WriteLine stops working
It seems that Visual Studio's handinlg of debug.writeline can't handle multiple processeses that each use multiple threads correctly. Eventually the 2 processes will deadlock the portion of visual studio that handles the output, causing it to stop working.
The solution is to wrap your calls to debug.writeline in a class that synchronizes across processes using a named mutex. This prevents multiple processes from writing to debug at the same time, nicely side stepping the whole deadlock problem.
The wrapper:
public class Debug
{
#if DEBUG
private static readonly Mutex DebugMutex =new Mutex(false,#"Global\DebugMutex");
#endif
[Conditional("DEBUG")]
public static void WriteLine(string message)
{
DebugMutex.WaitOne();
System.Diagnostics.Debug.WriteLine(message);
DebugMutex.ReleaseMutex();
}
[Conditional("DEBUG")]
public static void WriteLine(string message, string category)
{
DebugMutex.WaitOne();
System.Diagnostics.Debug.WriteLine(message,category);
DebugMutex.ReleaseMutex();
}
}
Or for those using VB.NET:
Imports System.Threading
Public Class Debug
#If DEBUG Then
Private Shared ReadOnly DebugMutex As New Mutex(False, "Global\DebugMutex")
#End If
<Conditional("DEBUG")> _
Public Shared Sub WriteLine(message As String)
DebugMutex.WaitOne()
System.Diagnostics.Debug.WriteLine(message)
DebugMutex.ReleaseMutex()
End Sub
<Conditional("DEBUG")> _
Public Shared Sub WriteLine(message As String, category As String)
DebugMutex.WaitOne()
System.Diagnostics.Debug.WriteLine(message, category)
DebugMutex.ReleaseMutex()
End Sub
End Class
Follow these steps, it works for me
Right click on your project
Select Properties
Select tab Build
Make sure Define DEBUG constant is checked
Hope that helps
I had the same problem with Visual Studio 2010. None of the above solutions worked in my case, but I solved it like this:
Right-click on your project.
Select Properties.
Click the Compile tab.
Scroll down to "Advanced Compile Options".
Change the value for "Generate debug info" from "pdb-only" to
"Full".
No idea what it's for exactly, but now my Debug.Print statements appear in the Immediate Window again I can finally get back to work.
you should try DebugView from Microsoft SystemInternals.
http://technet.microsoft.com/en-us/sysinternals/bb896647
Regards,
Allen
Try checking if Platform for the solution is set to Any CPU and not x86 (or x64). I used x86 to enable Edit and Continue and then lost Debug output. After going back to AnyCPU the Output is also back.
Got this in VS 2015. All of a sudden all Debug.WriteLine "stops working" (not showing in Output window). After going crazy about this for about an hour I found the problem:
1. Right click In output window (output from Debug)
2. Check that "Program output" is checked

VS2010 debugger debugging old code

I have a console app, and a class library.
I'm making changes to the class library (adding new methods, changing what methods do, etc) - Just regular stuff - nothing fancy.
In the console app - I'm calling methods from the class library - obviously to test the class library methods - again no rocket science here!
Both projects are targeting Framework 3.5 (This is because I have Sharepoint 2010 being referenced in class library)
Now:
When I debug the app using F5 - I've set a break point in the console app. When it steps through to the class library (using F11) I get a message saying source code has changed in a pretty lengthy dialog. If I click cancel - it then says No source code available.
I have found a work around to right click on project in solution explorer, then select debug -> create new instance.
But this is strange, never had this issue before, what can I do to get the debugger behaving normally. By normally I mean every time I hit F5 it should understand that the source code in the class library will almost surely have changed and I don't want any nags about this, or break point conditions never being met.
On a side note, never had this issue before, so an explanation as to why its happening would help a lot.
Thanks in advance
Update: the short version
Why do I have to manually tell the debugger to "create new instance" everytime I want to debug? If I don't hitting f5 debugs the source code of the last successful debug session.
Maybe your console application doesn't build second project? Try verifying that newest version of library is called.

Resources