Aspose.PDF Triggers Breakpoint

Asked by At

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.


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


1 Answers

Sergey Shevchenko On

I've never heard about Aspose.Pdf neither I know how does System::MakeObject< work. But for me it looks that all the code might be simplified to next:

Aspose::Pdf::License^ lic = gcnew Aspose::Pdf::License();
System::String^ str = "C:\\foo\\fooproj\\Aspose.Total.C++.lic";

When it comes to Pdf.Document the initialization might look like this:

Aspose::Pdf::Document^ doc = gcnew Aspose::Pdf::Document();