Fix clazy-qt6-deprecated-api-fixes warning for view->mapToScene(view->rect()).boundingRect(); - qt6

I have this code snippet
QRectF sceneRect = view->mapToScene(view->rect()).boundingRect();
where view is a QGraphicsView.
Later, I use sceneRect as
if(!sceneRect.contains(item->sceneBoundingRect()))
return false;
When I migrate this code to Qt6, Clazy (version 1.11) raises a warning that says clazy-qt6-deprecated-api-fixes warning.
So far, I do not see what has changed between Qt5 and Qt6. How should I modify this line so that the warning disappears?

Related

Visual Studio 2017 C++ exception message box

I try to show an exception (or error code) in C++ with visual studio 2017 when a crash occurs.
For example, the following codes does not show any dialog(message box).
int* p = 0;
*p = 10;
or
throw std::exception("some error");
Thus, I cannot attach it with just in time debugger.
In fact, the second code shows a dialog but it is not what I want.
UPDATE
Windows 10 does not support the WER dialog any more. - link
(link is provided by Hans Passant)
Undefined.
You should also note:
If the given example is complete (no further use of p), an exception might occur, but in release mode the code may be optimized. In this case, there would be no message at all.

MissingMethodException in Xamarin.iOS

I was facing the MissingMethodExeption while using the reflection method in Xamarin.iOS. My code works fine when Linker Behavior is set to Don't Link. But i am getting the above exception when Linker behavior is set to Link SDK assemblies. I have tried the workaround to set the --linkskip=System.Core but exception raised. Can you please let me know if you have any answer for this problem.
I am getting the error while performing the following operation. Activator.CreateInstance(resultType) as ScriptObject. Here resultType is a Type and ScriptObject is a class which perform some operations for me.
A quick and dirty way to avoid some methods/types to be linked out is to reference them in unused code:
if (false) {
var a = new TypeToPreserve();
a.MethodToPreserve();
}

Xcode8 beta adding self.view.layoutIfNeeded() in inputAccessoryView getter causing crash

Using Xcode8 Beta my simulator crashes when using an inputAccessoryView and adding the line self.view.layoutIfNeeded() in the getter of the inputAccessoryView override. It works fine on my devices but this one line causes the simulator to crash everytime
override var inputAccessoryView: UIView? {
get {
self.view.layoutIfNeeded()
return customToolbar
}
}
The following message is displayed in the console:
libc++abi.dylib: terminating with uncaught exception of type NSException
If I just remove the line: self.view.layoutIfNeeded() it will work fine on the simulator. I need that line though or else the collectionView momentarily bounces as the inputAccessoryView keyboard change notification is called.
You are probably fall into new layout loops. See changes in iOS 10 API here https://developer.apple.com/library/content/releasenotes/General/RN-iOSSDK-10.0/
Third party apps with custom UIView subclasses using Auto Layout that override layoutSubviews and dirty layout on self before calling super are at risk of triggering a layout feedback loop when they rebuild on iOS 10. When they are correctly sent subsequent layoutSubviews calls they must be sure to stop dirtying layout on self at some point (note that this call was skipped in release prior to iOS 10).

"mscorlib.pdb not loaded" yet the mscorlib.dll is NOT missing

I am running my application in VS2012 and I am getting a runtime error;
When I look in the "Original Location" I see mscorlib.dll, but not mscorlib.pdb.
Why is this happening and how do I fix it?
Goto Tools, Options, Debugging, General, Enable Just My Code
This will prevent the debugger from trying to launch on a Internal .NET Framework Assembly.
Goto Tools, Options, Debugging, Symbols and set a cache location. Then hit load in the above and it will fetch the necesary symbols for you and store them in the cache location you provide.
Microsoft's compiler tools create symbols in separate files with a .pdb extension (program database). This allows them to create detached symbols for release binaries. With a symbol server, your IDE can fetch the symbol file matching the specific version of the DLL during debugging. You can configure this system for your own product binaries as well which can be very useful for post-mortem debugging any crashes on end-user machines.
See Microsoft's documentation for more details about using their public symbols.
I had this issue when I was using a static variable, whose value is assigned off a static method.
So, whenever I ran the application, this line of code threw exception. If you place a debug point on this (like I did), you will notice the exception being thrown.
The best Solution to solve this error is:
1: Open App.config file.
2: Paste this useLegacyV2RuntimeActivationPolicy="true" code in the startup tag.
3: Save it.
Now the error would disappear.
Moreover see Image. I have done this for you.
This happened to me for a different reason: I had referenced an old version of NLog (2.0) and needed to reference version 4.0, instead.
In a VB console app, in my case it was none of the above.
Just doing a string calculation in the Dim declarations before my subs.
The offending code:
Dim FylPrefix$ = Fyl.Substring(0, Fyl.LastIndexOf("."))
Moving this calculation into the sub it was needed in fixed it! GERONIMO!!
This can happen when you initialize a variable in your class declarations and that initialization throws an exception:
class Program
{
static OracleConnection ora = getOracleConnection();
}
static void main(string[] args)
{
ora.Open();
}
static OracleConnection getOracleConnection()
{
OracleConnection orax = new OracleConnection(description=(host=myHost)
(port=1521)(protocol=tcp))(connect_data=(sid=mySid)));user id=user;password=pw;
}
If an exception is thrown by getOracleConnection() you can get this error. Move your assignment (but not necessarily your declaration) inside of main (where it belongs anyway), and you will get the actual exception that is causing the error instead of the mscorlib error.
In my case the exception began to appear after I changed the "Assembly name" in the "Application" tab of the properties window. If that's the case with you try reverting to the original name and see if the exception disappears.
Perhaps the reason for this was that the new name did not match the AssemblyTitle in AssemblyInfo.cs.
if you have this type of project runtime error in visualstudio
Answer:Cntr+Alt+E open Exception window Uncheck All chechboxes
Must and shoud its working written by B sriram Mca Giet College
rajahmundry, east godavary ,2014 batch

vs 2012: Shims compile

I am trying to make a shim in VS 2012 ultimate as it described in MSDN site:
[TestClass]
public class TestClass1
{
[TestMethod]
public void TestCurrentYear()
{
int fixedYear = 2000;
using (ShimsContext.Create())
{
// Arrange:
// Detour DateTime.Now to return a fixed date:
System.Fakes.ShimDateTime.NowGet =
() =>
{ return new DateTime(fixedYear, 1, 1); };
// Instantiate the component under test:
var componentUnderTest = new MyComponent();
// Act:
int year = componentUnderTest.GetTheCurrentYear();
// Assert:
// This will always be true if the component is working:
Assert.AreEqual(fixedYear, year);
}
}
}
see http://msdn.microsoft.com/en-us/library/hh549176.aspx
But when I compile my test project I get a notion in Output:
warning : Some fakes could not be generated. For complete details, set Diagnostic attribute of the Fakes element in this file to 'true' and rebuild the project.
How can I resolve this warning?
Visual Studio 2012 Update 1 improved code generation in Fakes to simplify troubleshooting of code generation problems. Whenever a Stub or a Shim could not be generated for a particular type, Fakes can now generate a warning message - you can see this in the Error List window of Visual Studio.
However, to prevent the number of warnings from becoming overwhelming for a large assembly, such as System, Fakes generates a single warning by default. You can see a complete list of warning messages by setting the Diagnostic attribute of the Fakes XML element in the .Fakes file to "true" or "1" and rebuilding the project. (See the first line of code below for an example.)
To resolve the warning, change the .Fakes file to generate only those Stubs and Shims you need in your tests. Details here
here a complete list of available options
<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/" Diagnostic="true">
<Assembly Name="System" Version="4.0.0.0"/>
<StubGeneration Disable="true" />
<ShimGeneration>
<Clear/>
<Add FullName="System.DateTime!"/>
</ShimGeneration>
</Fakes>
I have resolved it already alone.
It was .Net Framework 4.0 in Property.
Changing on 4.5 resolve the problem.
Try removing those .Fakes file.
I removed them accidentally and compiled, and the warnings are gone.
I am not sure what the impact is, but everything seems to run fine. I think it causes the compile to recompile the fakes file everything there is a build.

Resources