#region Copyright (c) Microsoft Corporation /// /// Copyright (c) Microsoft Corporation. All Rights Reserved. /// Information Contained Herein is Proprietary and Confidential. /// #endregion using System; using System.ServiceModel.Description; using System.Xml; using System.Xml.Schema; #if WEB_EXTENSIONS_CODE namespace System.Web.Compilation.WCFModel #else namespace Microsoft.VSDesigner.WCFModel #endif { /// /// This class represents an error message happens when we generate code /// /// #if WEB_EXTENSIONS_CODE internal class ProxyGenerationError #else [CLSCompliant(true)] public class ProxyGenerationError #endif { private bool m_IsWarning; private string m_Message; private string m_MetadataFile; private int m_LineNumber; private int m_LinePosition; private GeneratorState m_ErrorGeneratorState; /// /// Constructor /// /// MetadataConversionError /// public ProxyGenerationError(MetadataConversionError errorMessage) { m_ErrorGeneratorState = GeneratorState.GenerateCode; m_IsWarning = errorMessage.IsWarning; m_Message = errorMessage.Message; m_MetadataFile = String.Empty; m_LineNumber = -1; m_LinePosition = -1; } /// /// Constructor /// /// /// /// An IOException /// public ProxyGenerationError(GeneratorState generatorState, string fileName, Exception errorException) { m_ErrorGeneratorState = generatorState; m_IsWarning = false; m_Message = errorException.Message; m_MetadataFile = fileName; m_LineNumber = -1; m_LinePosition = -1; } /// /// Constructor /// /// /// /// An IOException /// An IOException /// public ProxyGenerationError(GeneratorState generatorState, string fileName, Exception errorException, bool isWarning) { m_ErrorGeneratorState = generatorState; m_IsWarning = isWarning; m_Message = errorException.Message; m_MetadataFile = fileName; m_LineNumber = -1; m_LinePosition = -1; } /// /// Constructor /// /// /// /// An XmlException /// public ProxyGenerationError(GeneratorState generatorState, string fileName, XmlException errorException) { m_ErrorGeneratorState = generatorState; m_IsWarning = false; m_Message = errorException.Message; m_MetadataFile = fileName; m_LineNumber = errorException.LineNumber; m_LinePosition = errorException.LinePosition; } /// /// Constructor /// /// /// /// An XmlException /// public ProxyGenerationError(GeneratorState generatorState, string fileName, XmlSchemaException errorException) { m_ErrorGeneratorState = generatorState; m_IsWarning = false; m_Message = errorException.Message; m_MetadataFile = fileName; m_LineNumber = errorException.LineNumber; m_LinePosition = errorException.LinePosition; } /// /// Constructor /// /// /// /// An XmlException /// An XmlException /// public ProxyGenerationError(GeneratorState generatorState, string fileName, XmlSchemaException errorException, bool isWarning) { m_ErrorGeneratorState = generatorState; m_IsWarning = isWarning; m_Message = errorException.Message; m_MetadataFile = fileName; m_LineNumber = errorException.LineNumber; m_LinePosition = errorException.LinePosition; } /// /// This property represents when an error message happens /// /// /// public GeneratorState ErrorGeneratorState { get { return m_ErrorGeneratorState; } } /// /// True: if it is a warning message, otherwise, an error /// /// /// public bool IsWarning { get { return m_IsWarning; } } /// /// Line Number when error happens /// /// /// public int LineNumber { get { return m_LineNumber; } } /// /// Column Number in the line when error happens /// /// /// public int LinePosition { get { return m_LinePosition; } } /// /// return the error message /// /// /// public string Message { get { return m_Message; } } /// /// return the error message /// /// /// public string MetadataFile { get { return m_MetadataFile; } } /// /// This enum represents when an error message happens /// /// public enum GeneratorState { LoadMetadata = 0, MergeMetadata = 1, GenerateCode = 2, } } }