/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; namespace dnSpy.Debugger.DotNet.Metadata { /// /// Thrown when a type or member couldn't be resolved /// [Serializable] public class ResolveException : Exception { /// /// Constructor /// /// Message public ResolveException(string message) : base(message) { } } /// /// Thrown when a type couldn't be resolved /// [Serializable] public sealed class TypeResolveException : ResolveException { /// /// Gets the type that couldn't be resolved /// public DmdType Type { get; } /// /// Constructor /// /// Type that couldn't be resolved public TypeResolveException(DmdType type) : base("Couldn't resolve type: " + type.ToString()) => Type = type; } /// /// Thrown when a field couldn't be resolved /// [Serializable] public sealed class FieldResolveException : ResolveException { /// /// Gets the field that couldn't be resolved /// public DmdFieldInfo Field { get; } /// /// Constructor /// /// Field that couldn't be resolved public FieldResolveException(DmdFieldInfo field) : base("Couldn't resolve field: " + field.ToString() + ", type: " + field.DeclaringType!.ToString()) => Field = field; } /// /// Thrown when a method couldn't be resolved /// [Serializable] public sealed class MethodResolveException : ResolveException { /// /// Gets the method that couldn't be resolved /// public DmdMethodBase Method { get; } /// /// Constructor /// /// Method that couldn't be resolved public MethodResolveException(DmdMethodBase method) : base("Couldn't resolve method: " + method.ToString() + ", type: " + method.DeclaringType!.ToString()) => Method = method; } }