Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSCTF.dll complains 'An assertion failure has occurred'

I'm developing application on Win11 with Win10 SDK, here is my environment:

  • MSVC v142
  • Win10 SDK(10.0.19041.0)
  • PCL 1.12.1
  • OpenCV 4.8.0
  • Qt 5.15.2

When I run my application from Qt Creator in debug mode, it complains:

clientcore\windows\advcore\ctf\uim\tim.cpp(800)\MSCTF.dll!00007FFA625262B9: 
(caller: 00007FFA62526EEC) LogHr(1) tid(267c) 8007029C 
An assertion failure has occurred.

Minimal example:

header

#ifndef MINIMAL_H
#define MINIMAL_H

#include <QMainWindow>
#include <pcl/io/pcd_io.h>
#include <opencv2/opencv.hpp>

QT_BEGIN_NAMESPACE
namespace Ui
{
  class Minimal;
}
QT_END_NAMESPACE

class Minimal : public QMainWindow
{
  Q_OBJECT

public:
  Minimal(QWidget *parent = nullptr);
  ~Minimal();

private:
  bool readPcd(const QString &file, pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud);

  bool readImage(const QString &file, cv::Mat &image);

  Ui::Minimal *ui;
};
#endif // MINIMAL_H

source

#include "minimal.h"
#include "./ui_minimal.h"
#include <QDebug>

Minimal::Minimal(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::Minimal)
{
  ui->setupUi(this);

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud;
  readPcd("..\\example_data\\20210209152054.pcd", cloud);
  qDebug() << "cloud size is " << cloud->points.size();

  cv::Mat image;
  readImage("..\\example_data\\20210209152054.jpg", image);
  qDebug() << "image size is " << image.cols << " x " << image.rows;
}

Minimal::~Minimal()
{
  delete ui;
}

bool Minimal::readPcd(const QString &file, pcl::PointCloud<pcl::PointXYZ>::Ptr &cloud)
{
  cloud.reset(new pcl::PointCloud<pcl::PointXYZ>);
  if(pcl::io::loadPCDFile(file.toStdString(), *cloud) == -1)
  {
    std::cout << "read pcd file error " << std::endl;
    return false;
  }
  return true;
}

bool Minimal::readImage(const QString &file, cv::Mat &image)
{
  image = cv::imread(file.toStdString());
  return (!image.empty());
}

===== Updated ===== add main.cpp created by qtcreator

main.cpp

#include "minimal.h"

#include <QApplication>
#include <QLocale>
#include <QTranslator>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QTranslator translator;
    const QStringList uiLanguages = QLocale::system().uiLanguages();
    for (const QString &locale : uiLanguages) {
        const QString baseName = "Minimal_" + QLocale(locale).name();
        if (translator.load(":/i18n/" + baseName)) {
            a.installTranslator(&translator);
            break;
        }
    }
    Minimal w;
    w.show();
    return a.exec();
}

What can I do?


1 Answers

This is not an issue with your program, it's a bug with the new "shell handwriting" feature (MTestAbSh1, 41799415) that's currently in experiment. You can download ViVeTool to check whether the feature is enabled:

vivetool /query /id:41799415

If you're like me, this feature is probably set to "Experiment" meaning it's enabled on your machine for testing. You can disable it with:

vivetool /disable /id:41799415

Which will manually override it to disable the feature. This doesn't take effect immediately, and you'll need to restart afterward. Afterward, the assertion failure should no longer appear.

I ran into this issue a month or so ago and have reported this issue through a couple different avenues. I wrote up some of my process for decompiling and debugging MSCTF.dll on twitter.

like image 75
David Koloski Avatar answered Oct 26 '25 17:10

David Koloski