简体   繁体   English

调试版本中 exe_common.inl 中的随机错误

[英]Random error in exe_common.inl in Debug build

I am using VS 2022 Community Edition (v17.3.3) to build wxWidgets application (v3.2.0) using C++ (v14.3 - Features from Latest C++).我正在使用 VS 2022 社区版(v17.3.3)使用 C++(v14.3 - 最新 C++ 的功能)构建 wxWidgets 应用程序(v3.2.0)。 The windows SDK is using the latest installed (10.0.22621). windows SDK 使用最新安装的 (10.0.22621)。 The project is also using C++ modules.该项目还使用 C++ 模块。

The Debug build succeeds but when I run the project's exe file at random it throws the exception ( Access violation reading 0xFFFFFF (ucrtbased.dll) ) in exe_common.inl at the following line: Debug 构建成功,但是当我随机运行项目的 exe 文件时,它会在exe_common.inl中的以下行引发异常(访问冲突读取 0xFFFFFF (ucrtbased.dll) ):

__scrt_current_native_startup_state = __scrt_native_startup_state::initialized;

After a few more compilations (by just making minor changes to trigger a compilation) it succeeds and the exe runs correctly.经过几次编译(只需进行微小的更改即可触发编译),它成功并且 exe 正确运行。

I wonder if there is any settings that might be causing this random error.我想知道是否有任何设置可能导致此随机错误。 Btw, I am using Win11 but same thing happens on Win10 as well.顺便说一句,我使用的是 Win11,但同样的事情也发生在 Win10 上。

Thanks in advance.提前致谢。

EDIT 1:编辑1:

The project is using boost libraries and at startup boost/json (boost/json is used in other parts of the project as well).该项目正在使用 boost 库,并且在启动时 boost/json (boost/json 也用于项目的其他部分)。 Debugger shows that after the following line the above error happens:调试器显示,在以下行之后发生了上述错误:

static allocator_arg_t allocator_arg = BOOST_CONTAINER_DOC1ST(unspecified, *std_allocator_arg_holder<>::dummy);

There were a few things needed attention:有几点需要注意:

  1. Discontinued use of wxSQLite (the library was not maintained for over a decade),停止使用wxSQLite (该库已超过十年未维护),
  2. The main frame was a singleton data structure, not anymore, and not deriving from wxMDIFrame anymore.主框架是 singleton 数据结构,不再是,也不再从 wxMDIFrame 派生。
  3. All unnecessary (a chain of them) #include removed.所有不必要的(一连串) #include已删除。
  4. Inclusion of <boost/json.hpp> in a few files were removed and now using #include <boost/json/src.hpp> only in one.cpp file.在几个文件中包含<boost/json.hpp>已被删除,现在仅在 one.cpp 文件中使用#include <boost/json/src.hpp> However, the project still uses inclusion of <boost/json/value.hpp> in multiple.h files.但是,该项目仍然使用在 multiple.h 文件中包含<boost/json/value.hpp>
  5. All uninitialized pointer variables and others were initialized.所有未初始化的指针变量和其他变量都已初始化。

#1 and #4 were especially pointed by the debugger.调试器特别指出了#1 和#4。 It has now been more than a few days and haven't had the problem since then.现在已经有几天多了,从那以后就没有问题了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM