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 (show other bugs)
Version: 4.2.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-05-21 11:39 UTC by Jon Skeet
Modified: 2016-05-21 12:02 UTC (History)
3 users (show)

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


Attachments

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:

```text
$ 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
```

project.json:

```text
{
  "buildOptions": {
    "emitEntryPoint": true
  },
  "dependencies": {
  },
  "frameworks": {
    "net451": {}
  }
}
```

Program.cs:

```csharp
using System;
class Program
{
    static void Main()
    {
        try
	{
	    throw new Exception();
	}
	catch(System.Exception e)
	{
	    Console.WriteLine(e.StackTrace);
	}
    
    }
}
```

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


```text
* Assertion at metadata.c:1016, condition `idx < t->rows' not met
* Assertion at metadata.c:1016, condition `idx < t->rows' not met
Stacktrace:
  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 ***

Note You need to log in before you can comment on or make changes to this bug.