Hi,
after migration to v.030 I found that debug version produce assertion error like this:
Assertion failed!
Program: D:\mingw\projects\******.exe
File: c:/mingw32/user/include/simplexlsx_last/XMLWriter.hpp, Line 304
Expression: m_LightTagCounter == 0
Process returned 3 (0x3) execution time : 19.114 s
Press any key to continue.
while with v029 everything was fine.
Just in case for all cells I also did like this:
Hi,
This assertion error should occur when the XML-file is incorrectly created.
It's very strange that you do not get this assertion error with v029.
Difference between v029 and v030 only in line 816 of SimpleXlsxDef.h.
Is this problem stable?
Can you run your debug version under the debugger and see the stack of function calls before the assertion error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, I found issue: "debug" version of main cannot be mixed with "release" library: in such case case varible m_LightTagCounter may be not initialized. And in general instances of the "XMLWriter" are not properly initialized. However, i wander if functions
inline void DebugCheck****
can be organized in diffferent manner. Now they just trap errors, but not provide proper line number.
Last edit: E.Naumovich 2018-09-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi ,
I made a correction for XMLWriter.hpp to avoid conflicts between release and debug code. to produce more useful assert output. My version is attached.
Hi,
Sorry for the long response and thank you for research of the problem and its possible solution.
I believe that the problem is due to the inclusion of the file "XMLWriter.hpp" in Worksheet.h, which is accessible from the main application.
The XMLWriter has a different internal structure between "debug" and "release" modes (see definition of m_LightTagCounter).
To avoid conflicts between "release" and "debug" modes I changed "Worksheet.h" and "Worksheet.cpp", please see attachment.
Hi,
now it exit through assert in both cases: debug and release with NDEBUG.
I used my version of the header. I not found "NDEBUD" switch in Worksheet. * files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Hmm, a strange situation. Can you provide a minimal working project with this error?
I was talking about the "NDEBUD" switch in the file "XMLWriter.hpp" which was included in "Worksheet.h". Because of this XMLWriter class could have a different internal structure in object file of the library and in the main application.
I'll try to explain by example. See the source code for version 0.30 of the library.
We compile the library in release with NDEBUG. The XMLWriter class will not contain m_LightTagCounter (because NDEBUG).
We compile the main application in debug. The compiler has access to XMLWriter via "Worksheet.h". And in this case the compiler find that XMLWriter class contain m_LightTagCounter (because "debug").
All methods from "Worksheet.h" that uses m_XMLWriter will use missing m_LightTagCounter (because library compiled with NDEBUG). This is an undefined behavior.
For this reason, I changed code in "Worksheet.h" and "Worksheet.cpp".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
after I rebuilt evertything carefully with your new "Worksheet.h" and "Worksheet.cpp" problems dissapeared. Likely I had mixed obj files,
Thank you,
E.N.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
after migration to v.030 I found that debug version produce assertion error like this:
while with v029 everything was fine.
Just in case for all cells I also did like this:
but it not help. Any idea?
Regards, EN.
Last edit: E.Naumovich 2018-09-05
Hi,
This assertion error should occur when the XML-file is incorrectly created.
It's very strange that you do not get this assertion error with v029.
Difference between v029 and v030 only in line 816 of SimpleXlsxDef.h.
Is this problem stable?
Can you run your debug version under the debugger and see the stack of function calls before the assertion error?
I`ll try tomorrow.
More strange that in "release" version nothing bad happens and Excel opens generated file.
OK, I found issue: "debug" version of main cannot be mixed with "release" library: in such case case varible m_LightTagCounter may be not initialized. And in general instances of the "XMLWriter" are not properly initialized. However, i wander if functions
can be organized in diffferent manner. Now they just trap errors, but not provide proper line number.
Last edit: E.Naumovich 2018-09-06
Hi ,
I made a correction for XMLWriter.hpp
to avoid conflicts between release and debug code.to produce more useful assert output. My version is attached.Last edit: E.Naumovich 2018-09-08
Hi,
Sorry for the long response and thank you for research of the problem and its possible solution.
I believe that the problem is due to the inclusion of the file "XMLWriter.hpp" in Worksheet.h, which is accessible from the main application.
The XMLWriter has a different internal structure between "debug" and "release" modes (see definition of m_LightTagCounter).
To avoid conflicts between "release" and "debug" modes I changed "Worksheet.h" and "Worksheet.cpp", please see attachment.
Hi,
now it exit through assert in both cases: debug and release with NDEBUG.
I used my version of the header. I not found "NDEBUD" switch in Worksheet. * files.
Hi,
Hmm, a strange situation. Can you provide a minimal working project with this error?
I was talking about the "NDEBUD" switch in the file "XMLWriter.hpp" which was included in "Worksheet.h". Because of this XMLWriter class could have a different internal structure in object file of the library and in the main application.
I'll try to explain by example. See the source code for version 0.30 of the library.
We compile the library in release with NDEBUG. The XMLWriter class will not contain m_LightTagCounter (because NDEBUG).
We compile the main application in debug. The compiler has access to XMLWriter via "Worksheet.h". And in this case the compiler find that XMLWriter class contain m_LightTagCounter (because "debug").
All methods from "Worksheet.h" that uses m_XMLWriter will use missing m_LightTagCounter (because library compiled with NDEBUG). This is an undefined behavior.
For this reason, I changed code in "Worksheet.h" and "Worksheet.cpp".
Hi,
Now I'm out of office until the end of the week. As soon as I can I'll make test project.
Hi,
after I rebuilt evertything carefully with your new "Worksheet.h" and "Worksheet.cpp" problems dissapeared. Likely I had mixed obj files,
Thank you,
E.N.
Hi,
thanks for testing and good news. I really appreciate your help in the development of the project.
Best regards,
Alexander