Handling Exceptions using Aspose.Tasks

Handling Exceptions While Working with Microsoft Project Files

Sometimes, Aspose customers are unable to load their projects because of unsupported features and other issues and do not want to share their projects for analysis on our Support forums.

The LogText property exposed by the TasksReadingException class is used to deal with such cases. You can use this property to identify the problematic section of the project, for example, a problematic task, resource, resource assignment etc.

After identifying the section that’s causing the problem, you can try to resolve the issue at your end or copy that data to a separate project and share with us to resolve the issue.

The following code is used to identify the cause of the exception.

 1Project project;
 4    project = new Project("New Project.mpp");
 6catch (TasksReadingException ex)
 8    Console.WriteLine("Message:");
 9    Console.WriteLine(ex.Message);
10    Console.WriteLine("Log:");
11    Console.WriteLine(ex.LogText);
12    if (ex.InnerException != null)
13    {
14        Console.WriteLine("Inner exception message:");
15        Console.WriteLine(ex.InnerException.Message);
16    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.