Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Regression: when debugger encounters a not-unhandled exception, it stops and shows "Dns.cs file not found" (Dns being the BCL class used) #17083

@knocte

Description

@knocte

I believe this is a regression because I haven't seen this behaviour in previous versions of VisualStudio for Mac (now using 8.2.4; not sure the exact version when this started happening, possibly when Mono 6.0 was bundled).

Steps to reproduce:

  1. Open VS4Mac, create new project/solution, Console type, language: C#.
  2. Use this simple snippet:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Threading.Tasks;

namespace TestResolveCSharpConsole
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            try
            {
                var results = ResolveAsync().GetAwaiter().GetResult();
            }
            catch (SocketException sockEx)
            {
                Console.WriteLine("correctly handled");
            }
        }

        public static async Task<List<string>> ResolveAsync()
        {
            var addresses = await System.Net.Dns.GetHostAddressesAsync("foo.bar.baz");
            return new List<string>(addresses.Select(addr => addr.ToString()));
        }
    }
}
  1. Compile it. (If you run it outside VS4Mac, result should just be the printing of the string "correctly handled".)
  2. Run it with the debugger inside VS4Mac.

Expected results:
Should just run it and not stop, finish execution at the end like it's the case when being run outside of VS4Mac.

Current results:
Debugger seems to bomb when a SocketException is thrown, even if it's properly handled with a try-catch (this is the first bug). Then it tries to open the source code of the BCL where this exception happened (Dns.cs), telling the weird error "Source Not Found" to the user.

See screenshot:
Screenshot 2019-08-28 at 3 56 16 PM

VS bug #973786, VS bug #989287

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions