Unable to debug the code for the aspose.pdf .net core v3.1 in VS2019(16.7.6)

Hello,

While setting the breakpoint inside of the code below and doing the step over the debugger fails with the following message

“The debugger’s worker process (msvsmon.exe) unexpectedly exited. Debugging will be aborted.”


static void Main(string[] args)
{
	InitLicense();

	string htmlFilePath = string.Format($"c:\\Temp\\aspose-dotnet\\enrichedDoc.html");
	string pdfFilePath = string.Format($"c:\\Temp\\springer.pdf");


	using (Stream stream = File.OpenRead(pdfFilePath))
	{
		
		using (Document doc = new Document(stream))
		{
			
			HtmlSaveOptions htmlOptions = new HtmlSaveOptions
			{
				FixedLayout = true,
				FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats,
				RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground
			};
		
			doc.Save(htmlFilePath, htmlOptions);
		}
	}

	Console.WriteLine("Hello World!");
}

In addition I see an error from visual studio remote debugger in the Event Viewer

“The description for Event ID 1002 from source Visual Studio Remote Debugger cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.”

At the same time the that code runs fine on .NET Framework 4.7.2. Also the program completes its execution gracefully .net core if I don’t set the breakpoint.

Could you please advise?

The issue can be reproduced on more than one machine.

@sergeimam

The issue does not seem related to the API. There could be some configuration settings in VS which need to be changed in order to prevent it. Would you please try the solutions given at this thread and in case issue still persists, please let us know. We will further proceed to assist you accordingly.

Hi Asad

Thank you for the link. I tried a few approaches which could be applicable to us(below) but no avail.

  • Change platform target
  • Update etc/hosts
  • Turn on managed compatibility mode in Options->Debugging->General
  • Turn off symbols loading

Resetting VS settings to default didn’t help as well.

The issue seems to be happening while the debugger is trying to access aspose objects for the evaluation and we didn’t observe such behavior with any other library we have been using.

In general this is not a showstopper for us as we can bypass the problematic code easily and continue debugging.

What concerns me is the stability of the library. Is there a resource available where I can see the list of the known issues for .net core version? particularly I am interested the ones which are Linux related

@sergeimam

There are no such known issues for running the API in Linux environment. There are some fonts and graphics dependencies which need to be installed and they are as follows:

  • MS Essential Fonts (msttcorefonts package)
  • libgdiplus package

Furthermore, could you please share some screenshots of the error that is being prompted at your end along with sample HTML file in .zip format. We will try to replicate the issue in our environment and address it accordingly. Also, please try changing the .NET Core version.

@asad.ali

I tried to fallback to .net core 2.1 and 2.2 and it worked fine. Thank you for the advice.
Also here is the error I am getting with .net core 3.1 and 3.0

evaluating expression before the crash.png (123.2 KB)
msvsmon-crash.png (43.1 KB)

The issue can be reproduced with any pdf so I don’t know if there is a value to attach a pdf or an output html file. But let me know if it does, I’ll prepare it for you.

@sergeimam

Thanks for sharing your feedback.

We have logged an investigation ticket as PDFNET-48931 in our issue management system for the sake of further analysis. We will look into details of the scenario and will let you know as soon as we have some definite updates regarding ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

I also have this same issue on .net core 3.1.

@tims-1

We have updated the ticket information accordingly and will inform you as well as soon as we have some news about its resolution.

We apologize for the inconvenience.

Any updates?

@tims-1

The issue has recently been logged in our issue management system and is pending for investigation. It will be analyzed and resolved on first come first serve basis. We will surely post updates in this forum thread as soon as we have some regarding its resolution. Please give us some time.

We apologize for the inconvenience caused.

@asad.ali this is a pretty big issue that your library crashes the VS debugger, do you think it could be looked at with more priority?

@tims-1

You are right. We do understand the severity of the issue and we already have been working over some tasks and improvements specially in reference to .NET Core 3.1 and Linux OS. As soon as ongoing work is done, we will investigate this ticket and share our feedback with you. At the moment, you can please try using .NET Core 2.0/2.1 as a workaround.

We really apologize for the inconvenience caused by this error.

Hi @asad.ali, any updates?

@tims-1

Regretfully, the ticket is not yet resolved. Please note that it is already of the highest priority and we are investigating the reasons behind this issue. We will soon try to share our investigation results with you as soon as it is completed. We highly appreciate your patience in this matter.

We apologize for the inconvenience caused.

Hi. I have the same problem with .net5, Windows and VS2019. Even in a simple HelloWorld app the debugger crashes with the same message if there is a breakpoint in any method which uses Aspose.Pdf. But works ok if I run without debugger, or if I remove breakpoints from that specific method.

Update: I have noticed that the constructor “Aspose.Pdf.License()” does not cause this problem, nor does the method “Aspose.Pdf.License.SetLicense()”. But debugging into any method with a local variable (or a parameter) of type “Aspose.Pdf.Document” will cause the the debugger to abort.

Debugging the following program recreates the problem if there is a breakpoint anywhere within it:

static void Main(string[] args)
{
    var asposeLicense = new Aspose.Pdf.License();
    asposeLicense.SetLicense("Aspose.Pdf.lic");

    Aspose.Pdf.Document dummy = null;

    Console.WriteLine("Done");
}

If you comment-out the line with “dummy” then it will be ok. Otherwise the presence of a breakpoint will cause VS to hang for a few secs with a message box saying “Evaluating local variables…” and then another message box pops up saying “The debugger’s worker process (msvsmon.exe) unexpectedly exited. Debugging will be aborted.”

If it helps - I think this must be related to presence of local variables (or method parameters) of certain types.
The following “Debuggable()” method always works ok. It does not have an explicit local variable for the Document. But the “NotDebuggable()” method will reproduce the problem if you step into it - this method has a Document local variable.

    static void Debuggable()
    {
        //No Aspose.Pdf local variables. Works ok if you debug here.
        int count = (new Aspose.Pdf.Document()).Pages.Count;
    }

    static void NotDebuggable()
    {
        //Contains an Aspose.Pdf.Document local variable. Bad if you debug here.
        var doc = new Aspose.Pdf.Document();
        int count = doc.Pages.Count;
    }

@alanf

Thanks for sharing the information. We have updated the earlier logged ticket and will certainly let you know as soon as we have additional updates in this regard. Please give us some time.