We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf creatinng a object crashes

I implemented Aspose.Cells and Aspose.PDF into our companies existing application. While I had some trouble with this (mostly caused by the fact that I tried to implement both APIs into the exat same file which was a bad idea) I figured out how to make it work more or less.

My Problem now is while Aspose.Cells works perfectly fine and doesn’t seem to have any unusual behavior Aspose.PDF already struggles with setting the license and even when I eventually got this to work I can’t even initiate a Aspose::Pdf::Document .

So the first totally unusual thing is the way I had to set the License in the Example code given with the Aspose Package and in the official resources the license is set like this.

auto lic = System::MakeObject<Aspose::Pdf::License>();

This code won’t run on my machine and cause the error.

Rough Translation

food.exe triggered a breakpoint


food.exe Hat einen Haltepunkt ausgelöst

The same happens when I initialise a System::String with a emtpy constructor like this.

 auto lic = System::MakeObject<Aspose::Pdf::License>();
 System::String str;

BUT if I initialise the System::String with an empty String in the first place setting the license seems to work just fine so this works.

 auto lic = System::MakeObject<Aspose::Pdf::License>();
 System::String str(u"");

If this code above works and I try to make an object from Aspose::Pdf::Document this will crash.

void Aspose_pdf::helloWorld()
  auto doc = System::MakeObject<Aspose::Pdf::Document>();

I actually have no idea what’s going on. I am not using any using namespace commands at the moment. Would be greate if someone had an idea how to fix this.

Edit: The error occures exactly in smart_ptr.h in the following function.

typename std::enable_if<!IsSmartPtr<T>::value, SmartPtr<T> >::type  MakeObject(Args&&... args)
    System::Detail::OwnNextObject ownershipSentry;
    T *const object = ::new T(std::forward<Args>(args)...);
    return SmartPtr<T>(object);

in the second line so T *const object = ::new T(std::forward<Args>(args)...); is “causing” the error or atleast here the error will ne triggered.

Best Regards
Lars Hagelstein


[Here] you will find a simple example of how my code looks in general. I Started with implementing Aspose.Pdf into my Programm so I edited my Additional Library directories,additional dependencies, additional include directories,preprozessor definitions and my stacksize to fit these settings given in the Aspose.Pdf examples. After this I created my Aspose_Pdf class and tested it. worked perferctly so far. After this I made the same edits to fit Aspose.Cells aswell. Also I created a class Aspose_Cells and tested it. While this worked now my Aspose_Pdf class stoped working. After a little time passed I managed to atleast get the License Activation for Aspose_Pdf to work from this point on I had the problems described above.

Additional Dependencies:


Additional Librariedirectories:


additional Includedirectories



Thanks for contacting support.

The issue seems related to your project structure and environment specific. Would you please make sure that you are using Visual Studio 2017 and latest C++ Runtime. Furthermore, please make sure that all references to API classes have been included in the common header file. In case issue still remains, please share a demo project with similar structure which you are having at your side.

Also, you may check an example C++ Project which is included in the ZIP Package of Aspose.PDF library. You can run examples from that project and check if it also creates some issue in your environment or runs without any issue. We hope this can be helpful.

Thank you for your response.

Please see my edit to understand how I tried to achive my goal there’s also a narrowed down sample code.
I Also tried the same with the two example projects from Aspose.Cells and Aspose.PDF
but I ran into the same issue.
To clarifiy if I just use one of the two APIs I don’t have a problem running the demos and also the code in our own project runs flawlessly.
While we use a common headerfile I am not able to implement all the .header files into due it causes crashes because they seem to be ambigious implementations.
Also last time I tried to implement all header files into one file it wasn’t really usefull because both aspose libraries have namespaces in common and this will throw “ambigious” errors.
As well my VS as my c++ Runtime are up to date.


We are checking further details at our side and will share our feedback with you shortly.

1 Like