Bug 41233 - Exception.StackTrace crashes VM (assertion at metadata.c:1016)
Summary: Exception.StackTrace crashes VM (assertion at metadata.c:1016)
Status: RESOLVED DUPLICATE of bug 36257
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 4.2.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-05-21 11:39 UTC by Jon Skeet
Modified: 2016-05-21 12:02 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jon Skeet 2016-05-21 11:39:37 UTC
Using `dotnet` Preview1 (002702). I'm not sure what that means in terms of the version of Mono used - I can't reproduce it with just mcs/mono.

Version information:

$ dotnet --info
.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  15.10
 OS Platform: Linux
 RID:         ubuntu.15.10-x64


  "buildOptions": {
    "emitEntryPoint": true
  "dependencies": {
  "frameworks": {
    "net451": {}


using System;
class Program
    static void Main()
	    throw new Exception();
	catch(System.Exception e)

Restore with `dotnet restore` (fine) and run with `dotnet run`:

* Assertion at metadata.c:1016, condition `idx < t->rows' not met
* Assertion at metadata.c:1016, condition `idx < t->rows' not met
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Diagnostics.StackTrace.get_trace (System.Exception,int,bool) <IL 0x0000f, 0xffffffff>
  at System.Diagnostics.StackTrace..ctor (System.Exception,int,bool) <0x00044>
  at System.Exception.get_StackTrace () <0x00054
Comment 1 Alexander Köplinger [MSFT] 2016-05-21 12:02:36 UTC
This is a problem with the portable pdb code in Mono 4.2, the issue was fixed in the upcoming Mono 4.4 (available in the beta channel).

You can work around the issue in dotnet CLI by using "dotnet run --configuration=Release" because then the CLI doesn't pass --debug to Mono and it skips parsing debug information.

*** This bug has been marked as a duplicate of bug 36257 ***