microsoft / microsoft/automatic-graph-layout

CancelException vs OperationCanceledException

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.5k
Forks
319
Avg merge
38m
Merged PRs (30d)
1

Description

at LayoutHelpers.cs I see:

#if SILVERLIGHT
        /// <summary>
        /// Calculates the graph layout
        /// </summary>
        /// <exception cref="CancelException">Thrown when the layout is canceled.</exception>
#else
        /// <summary>
        /// Calculates the graph layout
        /// </summary>
        /// <exception cref="System.OperationCanceledException">Thrown when the layout is canceled.</exception>
#endif
        public static void CalculateLayout...

but this causes warning:

Warning 5   XML comment on 'Microsoft.Msagl.Miscellaneous.LayoutHelpers.CalculateLayout(Microsoft.Msagl.Core.Layout.GeometryGraph, Microsoft.Msagl.Core.Layout.LayoutAlgorithmSettings, Microsoft.Msagl.Core.CancelToken)' has cref attribute 'CancelException' that could not be resolved  .....\automatic-graph-layout\GraphLayout\msagl\Miscellaneous\LayoutHelpers.cs   34  30  msaglsilverlight

I don't understand why a conditional is used there for Silverlight, since
https://msdn.microsoft.com/en-us/library/system.operationcanceledexception(v=vs.95).aspx
says there is an OperationCanceledException for Silverlight 5 (maybe that is older code that wanted to support Silveright 4? I don't see any need to still support SL4, esp. since MoonLight is now totally obsolete and PipeLight has been released [http://pipelight.net/cms/about.html] for Linux)

Probably needs changes to other places CancelException is used in the code to use OperationCanceledException instead.

Anyway even if SL5 hadn't added that class, one could have added such class and if somewhere CancelException was thrown by internal system code, could catch it and rethrow it again as OperationCanceledException to keep the code cleaner

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LayoutHelpers.cs, especially the conditional XML documentation for CalculateLayout, then search the codebase for other uses of CancelException. Check the Silverlight-specific references and the compiler warning, and confirm that the completed change removes the unresolved cref warning while preserving the intended cancellation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.