I think that the problem is solved. One of the external library used a directive #pragma pack (1) before an union, but no #pragma pack() were used to restore the default packaging.. This causes a misalignment that in my case means "crash".. I fixed the code of the external library and no need to change the default structure alignment of the project.
The question could be why this error raised only moving the project to VS2022, but I suppose that the answer should go deeper inside the compilation process..
All the best!