Bug 4975 - TypeLoadException when trying to debug anything
Summary: TypeLoadException when trying to debug anything
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Debugger ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Alan McGovern
Depends on:
Reported: 2012-05-09 14:20 UTC by Nikita Tsukanov
Modified: 2012-05-09 18:47 UTC (History)
1 user (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 Developer Community or GitHub 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 Nikita Tsukanov 2012-05-09 14:20:58 UTC
I'm not sure what exactly happens, but when I had added Console.WriteLine (ex.ToString ()) to DotNetProject.cs, I've managed to get following stack trace:

System.TypeLoadException: A type load exception has occurred.
  at MonoDevelop.Debugger.DebuggerEngine.CreateSession () [0x00006] in /build/buildd/monodevelop-latest-1336547739/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggerEngine.cs:97 
  at MonoDevelop.Debugger.DebuggingService.InternalRun (MonoDevelop.Core.Execution.ExecutionCommand cmd, MonoDevelop.Debugger.DebuggerEngine factory, IConsole c) [0x0005d] in /build/buildd/monodevelop-latest-1336547739/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs:505 
  at MonoDevelop.Debugger.DebugExecutionHandler.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x00000] in /build/buildd/monodevelop-latest-1336547739/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs:70 
  at MonoDevelop.Debugger.DebugExecutionHandlerFactory.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x0000e] in /build/buildd/monodevelop-latest-1336547739/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs:51 
  at MonoDevelop.Projects.DotNetProject.DoExecute (IProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector configuration) [0x000b2] in /tmp/mdev/monodevelop-latest-1336547739/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProject.cs:1157
Comment 1 Nikita Tsukanov 2012-05-09 14:38:02 UTC
For some reason Mono doesn't even fill TypeName property of TypeLoadException so I cann't find the class that causes the exception.
Comment 2 Mikayla Hutchinson [MSFT] 2012-05-09 15:03:03 UTC
Can you provide more info about the versions of MD and Mono, and your OS/distro?
Comment 3 Nikita Tsukanov 2012-05-09 15:14:05 UTC
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:        12.04
Codename:       precise

Mono JIT compiler version (Debian
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug 
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

MonoDevelop from Git, configure options: .--prefix=/usr --profile=dist

Actually it works fine when I start it with make run, but gives me that exception when I try to use installed version.
Comment 4 Nikita Tsukanov 2012-05-09 15:23:42 UTC
Hm, when I've copied everything from main/build/bin to /usr/lib/monodevelop/bin, it works again.
Comment 5 Nikita Tsukanov 2012-05-09 15:32:57 UTC
I've found the issue: Mono.Cecil.Mdb.dll isn't installed at all and because of that MonoDevelop is unable to load debugger.

Solution: add Mono.Cecil.Mdb.dll to the list of files to be installed.
Comment 6 Mikayla Hutchinson [MSFT] 2012-05-09 16:44:18 UTC
Looks like install targets got broken.
Comment 7 Alan McGovern 2012-05-09 18:47:39 UTC
Yes, this was my bad. I missed the .Mdb library when switching to the cecil submodule. I only included Mono.Cecil.dll and Mono.Cecil.dll.mdb.

Fixed in master and 3.0-series.