public ErrorCode Run(Action func) { try { func(); LastErrorMessage = String.Empty; LastErrorCode = ErrorCode.OK; } catch (RantRuntimeException ex) { LastErrorMessage = ex.Message; LastErrorCode = ErrorCode.RuntimeError; } catch (RantCompilerException ex) { LastErrorMessage = ex.Message; LastErrorCode = ErrorCode.CompileError; } catch (Exception ex) { LastErrorMessage = ex.Message; LastErrorCode = ErrorCode.OtherError; } return LastErrorCode; }
public static void registerErrorHandler(ErrorCode error, GameErrorCallback cb) { Handler handler = new Handler(); handler.callback = cb; _error_handlers[error] = handler; }
internal SyntaxDiagnosticInfo(int offset, int width, ErrorCode code, params object[] args) : base(CSharp.MessageProvider.Instance, (int)code, args) { Debug.Assert(width >= 0); this.Offset = offset; this.Width = width; }
public virtual ActionResult AjaxRedirect(ErrorCode result, string successUrl, string failUrl = "") { AjaxStatusCode status = result == ErrorCode.NoError ? AjaxStatusCode.Success : AjaxStatusCode.Error; string targetAction = result == ErrorCode.NoError ? successUrl : failUrl; string message = EnumHelper.GetDescription(result); return MyAjaxHelper.RedirectAjax(status, message, null, targetAction); }
public static ErrorCode CheckError (ErrorCode error) { if (IsError (error)) throw ErrorException (error); return error; }
public static void throwErrorIfNotSuccessfull(ErrorCode errorCode, string message) { if (errorCode != ErrorCode.Success) { throw new OpenClError(); } }
// Generate an error if CType is static. public bool CheckForStaticClass(Symbol symCtx, CType CType, ErrorCode err) { if (!CType.isStaticClass()) return false; ReportStaticClassError(symCtx, CType, err); return true; }
public override void CopyRequest(ErrorCode status, int index) { var userName = Request.Parameters.UserName; var privacy = Users.Find(userName); var time = Group.EngineTimeData; Response = new ResponseMessage( Request.Version, new Header( new Integer32(Request.MessageId()), new Integer32(Messenger.MaxMessageSize), privacy.ToSecurityLevel()), new SecurityParameters( Group.EngineId, new Integer32(time[0]), new Integer32(time[1]), userName, privacy.AuthenticationProvider.CleanDigest, privacy.Salt), new Scope( Group.EngineId, OctetString.Empty, new ResponsePdu( Request.RequestId(), status, index, Request.Pdu().Variables)), privacy, true, null); if (TooBig) { GenerateTooBig(); } }
internal UsbError(ErrorCode errorCode, int win32ErrorNumber, string win32ErrorString, string description, object sender) { mSender = sender; string senderText = String.Empty; if ((mSender is UsbEndpointBase)|| (mSender is UsbTransfer)) { UsbEndpointBase ep; if (mSender is UsbTransfer) ep = ((UsbTransfer)mSender).EndpointBase; else ep = mSender as UsbEndpointBase; if (ep.mEpNum != 0) { senderText = senderText+=string.Format(" Ep 0x{0:X2} ", ep.mEpNum); } } else if (mSender is Type) { Type t = mSender as Type; senderText = senderText += string.Format(" {0} ", t.Name); } mErrorCode = errorCode; mWin32ErrorNumber = win32ErrorNumber; mWin32ErrorString = win32ErrorString; mDescription = description + senderText; }
public virtual OperationResponse GetResponse(ErrorCode errorCode, string debugMessage = "") { var response = new OperationResponse(OperationRequest.OperationCode); response.ReturnCode = (short) errorCode; response.DebugMessage = debugMessage; return response; }
internal static DiagnosticSeverity GetSeverity(ErrorCode code) { if (code == ErrorCode.Void) { return InternalDiagnosticSeverity.Void; } else if (code == ErrorCode.Unknown) { return InternalDiagnosticSeverity.Unknown; } else if (IsWarning(code)) { return DiagnosticSeverity.Warning; } else if (IsInfo(code)) { return DiagnosticSeverity.Info; } else if (IsHidden(code)) { return DiagnosticSeverity.Hidden; } else { return DiagnosticSeverity.Error; } }
/// <summary> /// Constructor setting error code /// </summary> public GlobalizationError(ErrorCode error) { this.Code = error; switch (error) { case ErrorCode.ParsingError: { this.Message = ParsingError; break; } case ErrorCode.FormattingError: { this.Message = FormattingError; break; } case ErrorCode.PatternError: { this.Message = PatternError; break; } default: { this.Message = UnknownError; break; } } }
private static string FormatMessage(ErrorCode errorCode, string info) { switch (errorCode) { case ErrorCode.TooManyWarnings: info = string.Format("There are more than {0} warnings", CodeGeneratorWarnings.MaximumWarningCount); break; case ErrorCode.InvalidIncludeTemplateFormat: info = "Include placeholders must have the following format: $NAME$(filename)"; break; case ErrorCode.InvalidIncludeTemplateFormatOpeningBracket: info = string.Format("{0} is missing \"(\"", info); break; case ErrorCode.InvalidIncludeTemplateFormatClosingBracket: info = string.Format("{0} is missing \")\"", info); break; } if (info == null || info == string.Empty) info = "No Info"; // should not occur return string.Format("OBLXE{0:d4}: {1}: {2}", (int)errorCode, errorCode.ToString(), info); }
public override void ReportError(ErrorCode errorCode, string message, string file, int lineNumber) { if(errorCode == ErrorCode.Assertion || errorCode == ErrorCode.InternalError || errorCode == ErrorCode.OutOfMemory ) ActiveLogger.LogMessage("PhysX: " + message, LogLevel.FatalError); else ActiveLogger.LogMessage("PhysX: " + message, LogLevel.RecoverableError); }
internal static void ThrowOnFailure(ErrorCode errorCode) { if (errorCode >= 0) return; switch (errorCode) { case ErrorCode.OutOfHostMemory: throw new OutOfMemoryException("Could not allocate OpenCL resources on the host."); case ErrorCode.OutOfResources: throw new OutOfMemoryException("Could not allocate OpenCL resources on the device."); case ErrorCode.DevicePartitionFailed: throw new InvalidOperationException("The device could not be further partitioned."); case ErrorCode.InvalidDevicePartitionCount: throw new InvalidOperationException("Invalid device partition size."); case ErrorCode.InvalidCommandQueue: throw new ArgumentException("Invalid command queue."); case ErrorCode.InvalidEventWaitList: throw new ArgumentException("The event wait list contained an invalid event."); case ErrorCode.InvalidDevice: throw new ArgumentException("Invalid device."); case ErrorCode.InvalidValue: throw new ArgumentException("Invalid value."); default: throw new Exception(string.Format("Unknown error code: {0}", errorCode)); } }
public Issue( ErrorCode errorCode, CommonSyntaxNode syntaxNode, ISymbol symbol) { #region Input validtion if (!Enum.IsDefined(typeof(ErrorCode), errorCode)) { throw new ArgumentException("errorCode is not defined.", "errorCode"); } if (syntaxNode == null) { throw new ArgumentNullException("syntaxNode"); } if (symbol == null) { throw new ArgumentNullException("symbol"); } #endregion _errorCode = errorCode; _description = DescriptionResolver.GetDescription(errorCode); _syntaxNode = syntaxNode; _symbol = symbol; _location = syntaxNode.GetLocation(); _sourceLineNumber = GetSourceLineNumber(); _sourceLineText = GetSourceLineText(_sourceLineNumber); _sourceFileName = GetSourceFileName(); }
/// <summary> /// Initializes a new instance of the <see cref="ProtocolException"/> class. /// </summary> /// <param name="protocolVersion">The CQL binary protocol version in use.</param> /// <param name="code">The code.</param> /// <param name="message">The message.</param> /// <param name="tracingId">The tracing identifier.</param> internal ProtocolException(byte protocolVersion, ErrorCode code, string message, Guid? tracingId) : base(code + ": " + message) { Code = code; ProtocolVersion = protocolVersion; TracingId = tracingId; }
static FastConstants() { ANY_TYPE = new QName("any"); ERROR = FastAlertSeverity.ERROR; WARN = FastAlertSeverity.WARN; FATAL = FastAlertSeverity.FATAL; DYNAMIC = new ErrorType("Dynamic"); STATIC = new ErrorType("Static"); REPORTABLE = new ErrorType("Reportable"); S1_INVALID_XML = new ErrorCode(STATIC, 1, "ERR S1", "Invalid XML", ERROR); S2_OPERATOR_TYPE_INCOMP = new ErrorCode(STATIC, 2, "ERR S2", "Incompatible operator and type", ERROR); S3_INITIAL_VALUE_INCOMP = new ErrorCode(STATIC, 3, "ERR S3", "Incompatible initial value", ERROR); S4_NO_INITIAL_VALUE_FOR_CONST = new ErrorCode(STATIC, 4, "ERR S4", "Fields with constant operators must have a default value defined.", ERROR); S5_NO_INITVAL_MNDTRY_DFALT = new ErrorCode(STATIC, 5, "ERR S5", "No initial value for mandatory field with default operator", ERROR); D1_FIELD_APP_INCOMP = new ErrorCode(DYNAMIC, 1, "ERR D1", "Field cannot be converted to type of application field", ERROR); D2_INT_OUT_OF_RANGE = new ErrorCode(DYNAMIC, 2, "ERR D2", "The integer value is out of range for the specified integer type.", WARN); D3_CANT_ENCODE_VALUE = new ErrorCode(DYNAMIC, 3, "ERR D3", "The value cannot be encoded for the given operator.", ERROR); D4_INVALID_TYPE = new ErrorCode(DYNAMIC, 4, "ERR D4", "The previous value is not the same type as the type of the current field.", ERROR); D5_NO_DEFAULT_VALUE = new ErrorCode(DYNAMIC, 5, "ERR D5", "If no prior value is set and the field is not present, there must be a default value or the optional flag must be set.", ERROR); D6_MNDTRY_FIELD_NOT_PRESENT = new ErrorCode(DYNAMIC, 6, "ERR D6", "A mandatory field must have a value", ERROR); D7_SUBTRCTN_LEN_LONG = new ErrorCode(DYNAMIC, 7, "ERR D7", "The subtraction length is longer than the base value.", ERROR); D8_TEMPLATE_NOT_EXIST = new ErrorCode(DYNAMIC, 8, "ERR D8", "The referenced template does not exist.", ERROR); D9_TEMPLATE_NOT_REGISTERED = new ErrorCode(DYNAMIC, 9, "ERR D9", "The template has not been registered.", ERROR); R1_LARGE_DECIMAL = new ErrorCode(REPORTABLE, 1, "ERR R1", "Decimal exponent does not fit into range -63...63", WARN); R4_NUMERIC_VALUE_TOO_LARGE = new ErrorCode(REPORTABLE, 4, "ERR R4", "The value is too large.", WARN); R5_DECIMAL_CANT_CONVERT_TO_INT = new ErrorCode(REPORTABLE, 5, "ERR R5", "The decimal value cannot convert to an integer because of trailing decimal part.", WARN); R7_PMAP_OVERLONG = new ErrorCode(REPORTABLE, 7, "ERR R7", "The presence map is overlong.", WARN); R8_PMAP_TOO_MANY_BITS = new ErrorCode(REPORTABLE, 8, "ERR R8", "The presence map has too many bits.", WARN); R9_STRING_OVERLONG = new ErrorCode(REPORTABLE, 9, "ERR R9", "The string is overlong.", ERROR); GENERAL_ERROR = new ErrorCode(DYNAMIC, 100, "GENERAL", "An error has occurred.", ERROR); IMPOSSIBLE_EXCEPTION = new ErrorCode(DYNAMIC, 101, "IMPOSSIBLE", "This should never happen.", ERROR); IO_ERROR = new ErrorCode(DYNAMIC, 102, "IOERROR", "An IO error occurred.", FATAL); PARSE_ERROR = new ErrorCode(DYNAMIC, 103, "PARSEERR", "An exception occurred while parsing.", ERROR); LENGTH_FIELD = new QName("length", TEMPLATE_DEFINITION_1_1); }
/// <summary> /// Initializes a new instance of the <see cref="TimeOutException"/> class. /// </summary> /// <param name="protocolVersion">The CQL binary protocol version in use.</param> /// <param name="code">The error code.</param> /// <param name="message">The message.</param> /// <param name="cqlConsistency">The CQL consistency.</param> /// <param name="received">The number of nodes of which a response is received.</param> /// <param name="blockFor">The number of nodes the query was waiting for.</param> /// <param name="tracingId">The tracing identifier.</param> protected TimeOutException(byte protocolVersion, ErrorCode code, string message, CqlConsistency cqlConsistency, int received, int blockFor, Guid? tracingId) : base(protocolVersion, code, message, tracingId) { CqlConsistency = cqlConsistency; Received = received; BlockFor = blockFor; }
public string this[ErrorCode index] { get { return ErrorStore[index]; } }
///<summary>Returns whether this SqlException was caused by the given ErrorCode (A SQL Server error number)</summary> public static bool IsError(this SqlException sqlEx, ErrorCode error) { var code = sqlEx.Number; bool isErrorCode = Enum.IsDefined(typeof(ErrorCode), code); if (!isErrorCode) logger.Info(m => m("Code {0} undefined", code)); return isErrorCode && (ErrorCode)code == error; }
public Status(MessageHeader header, ErrorSeverity errorSeverity, ErrorCode errorCode, string description) : base(header, CommandType.Status) { Severity = errorSeverity; Code = errorCode; Description = description; }
public void TransformToOptionObject_CustomOptionObjectWithProperties_PropertyValuesAreEqual(ErrorCode errorCode) { var transform = InitTransform(); var customOptionObject = MockBasicCustomOptionObject(); customOptionObject.ErrorCode = errorCode; var result = transform.TransformToOptionObject(customOptionObject); var expected = new object[] { customOptionObject.EntityID, customOptionObject.EpisodeNumber, (double)customOptionObject.ErrorCode, customOptionObject.ErrorMesg, customOptionObject.Facility, customOptionObject.OptionId, customOptionObject.OptionStaffId, customOptionObject.OptionUserId, customOptionObject.SystemCode }; var actual = new object[] { result.EntityID, result.EpisodeNumber, result.ErrorCode, result.ErrorMesg, result.Facility, result.OptionId, result.OptionStaffId, result.OptionUserId, result.SystemCode }; CollectionAssert.AreEqual(expected, actual); }
/// <summary> /// Add a diagnostic to the bag. /// </summary> /// <param name="diagnostics"></param> /// <param name="code"></param> /// <param name="location"></param> /// <param name="args"></param> /// <returns></returns> internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location, params object[] args) { var info = new CSDiagnosticInfo(code, args); var diag = new CSDiagnostic(info, location); diagnostics.Add(diag); return info; }
internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location, ImmutableArray<Symbol> symbols, params object[] args) { var info = new CSDiagnosticInfo(code, args, symbols, ImmutableArray<Location>.Empty); var diag = new CSDiagnostic(info, location); diagnostics.Add(diag); return info; }
public BaseException(ErrorCode errorNumber, string errorMsg, Exception innerError) : base(errorMsg, innerError) { this.mTime = DateTime.Now; this.errorNumber = errorNumber; this.errorMsg = errorMsg + (innerError == null ? string.Empty : ": " + innerError.Message); }
public GetResponseMessage(int requestId, VersionCode version, OctetString community, ErrorCode error, int index, IList<Variable> variables) { if (variables == null) { throw new ArgumentNullException("variables"); } if (community == null) { throw new ArgumentNullException("community"); } if (version == VersionCode.V3) { throw new ArgumentException("Please use overload constructor for v3", "version"); } Version = version; Header = Header.Empty; Parameters = new SecurityParameters(null, null, null, community, null, null); GetResponsePdu pdu = new GetResponsePdu( requestId, error, index, variables); Scope = new Scope(pdu); Privacy = DefaultPrivacyProvider.DefaultPair; _bytes = SnmpMessageExtension.PackMessage(Version, Header, Parameters, Scope, Privacy).ToBytes(); }
public JabberException(ErrorCode errorCode) : base() { StreamError = false; CloseStream = false; this.ErrorCode = errorCode; }
public BaseException(ErrorCode errorNumber, string errorMsg) : base(errorMsg) { this.mTime = DateTime.Now; this.errorNumber = errorNumber; this.errorMsg = errorMsg; }
internal CompilerMessage(ErrorCode errorCode, string message, int lineNumber, string scriptName) { _message = message; _errorCode = errorCode; _lineNumber = lineNumber; _scriptName = scriptName ?? string.Empty; }
public static InfoBuffer GetKernelWorkGroupInfo(Kernel kernel, Device device, KernelWorkGroupInfo paramName, out ErrorCode error) { return(GetInfo(GetKernelWorkGroupInfo, kernel, device, paramName, out error)); }
public static InfoBuffer GetContextInfo(Context context, ContextInfo paramName, out ErrorCode error) { return(GetInfo(GetContextInfo, context, paramName, out error)); }
public static InfoBuffer GetDeviceInfo(Device device, DeviceInfo paramName, out ErrorCode error) { return(GetInfo(GetDeviceInfo, device, paramName, out error)); }
public static Device[] GetDeviceIDs(Platform platform, DeviceType deviceType, out ErrorCode error) { uint deviceCount; error = GetDeviceIDs(platform, deviceType, 0, null, out deviceCount); if (error != ErrorCode.Success) { return(new Device[0]); } var deviceIds = new Device[deviceCount]; error = GetDeviceIDs(platform, deviceType, deviceCount, deviceIds, out deviceCount); if (error != ErrorCode.Success) { return(new Device[0]); } return(deviceIds); }
public static InfoBuffer GetPlatformInfo(Platform platform, PlatformInfo paramName, out ErrorCode error) { return(GetInfo(Cl.GetPlatformInfo, platform, paramName, out error)); }
public static InfoBuffer GetEventProfilingInfo(Event e, ProfilingInfo paramName, out ErrorCode error) { return(GetInfo(GetEventProfilingInfo, e, paramName, out error)); }
public static InfoBuffer GetSamplerInfo(Sampler sampler, SamplerInfo paramName, out ErrorCode error) { return(GetInfo(GetSamplerInfo, sampler, paramName, out error)); }
public static InfoBuffer GetCommandQueueInfo(CommandQueue commandQueue, CommandQueueInfo paramName, out ErrorCode error) { return(GetInfo(GetCommandQueueInfo, commandQueue, paramName, out error)); }
public static InfoBuffer GetProgramInfo(Program program, ProgramInfo paramName, out ErrorCode error) { return(GetInfo(GetProgramInfo, program, paramName, out error)); }
public static InfoBuffer GetKernelInfo(Kernel kernel, KernelInfo paramName, out ErrorCode error) { return(GetInfo(GetKernelInfo, kernel, paramName, out error)); }
public static InfoBuffer GetImageInfo(IMem image, ImageInfo paramName, out ErrorCode error) { return(GetInfo(GetImageInfo, image, paramName, out error)); }
public static InfoBuffer GetProgramBuildInfo(Program program, Device device, ProgramBuildInfo paramName, out ErrorCode error) { return(GetInfo(GetProgramBuildInfo, program, device, paramName, out error)); }
public static IMem <T> CreateBuffer <T>(Context context, MemFlags flags, T[] hostData, out ErrorCode errcodeRet) where T : struct { return(new Mem <T>(CreateBuffer(context, flags, (IntPtr)(TypeSize <T> .SizeInt * hostData.Length), hostData, out errcodeRet))); }
public static ImageFormat[] GetSupportedImageFormats(Context context, MemFlags flags, MemObjectType imageType, out ErrorCode error) { uint imageFormatCount; error = GetSupportedImageFormats(context, flags, imageType, 0, null, out imageFormatCount); if (error != ErrorCode.Success) { return(new ImageFormat[0]); } var imageFormats = new ImageFormat[imageFormatCount]; error = GetSupportedImageFormats(context, flags, imageType, imageFormatCount, imageFormats, out imageFormatCount); if (error != ErrorCode.Success) { return(new ImageFormat[0]); } return(imageFormats); }
public static Context CreateContext(string platformWildCard, DeviceType deviceType, out ErrorCode error) { var platformNameRegex = WildcardToRegex(platformWildCard); Platform?currentPlatform = null; foreach (Platform platform in GetPlatformIDs(out error)) { if (platformNameRegex.Match(GetPlatformInfo(platform, PlatformInfo.Name, out error).ToString()).Success) { currentPlatform = platform; break; } } if (currentPlatform == null) { error = ErrorCode.InvalidPlatform; return(Context.Zero); } var compatibleDevices = from device in GetDeviceIDs(currentPlatform.Value, deviceType, out error) select device; if (!compatibleDevices.Any()) { error = ErrorCode.InvalidDevice; return(Context.Zero); } var devices = compatibleDevices.ToArray(); var context = CreateContext(null, (uint)devices.Length, devices, null, IntPtr.Zero, out error); if (error != ErrorCode.Success) { error = ErrorCode.InvalidContext; return(Context.Zero); } return(context); }
public static IMem <T> CreateBuffer <T>(Context context, MemFlags flags, int length, out ErrorCode errcodeRet) where T : struct { return(new Mem <T>(CreateBuffer(context, flags, (IntPtr)(TypeSize <T> .SizeInt * length), null, out errcodeRet))); }
private static string GetId(ErrorCode errorCode) { return(MessageProvider.Instance.GetIdForErrorCode((int)errorCode)); }
public static IMem CreateBuffer(Context context, MemFlags flags, IntPtr size, out ErrorCode errcodeRet) { return(CreateBuffer(context, flags, size, null, out errcodeRet)); }
public static string GetHelpLink(ErrorCode code) { return($"https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k({GetId(code)})"); }
private void Error(ErrorCode errorCode, string errorMsg) { Error(errorCode, errorMsg, false); }
public static LocalizableResourceString GetTitle(ErrorCode code) { return(new LocalizableResourceString(code.ToString() + s_titleSuffix, ResourceManager, typeof(ErrorFacts))); }
internal static int GetWarningLevel(ErrorCode code) { if (IsInfo(code) || IsHidden(code)) { // Info and hidden diagnostics should always be produced because some analyzers depend on them. return(Diagnostic.InfoAndHiddenWarningLevel); } switch (code) { case ErrorCode.WRN_NubExprIsConstBool2: case ErrorCode.WRN_StaticInAsOrIs: case ErrorCode.WRN_PrecedenceInversion: case ErrorCode.WRN_UnassignedThisAutoProperty: case ErrorCode.WRN_UnassignedThis: case ErrorCode.WRN_ParamUnassigned: case ErrorCode.WRN_UseDefViolationProperty: case ErrorCode.WRN_UseDefViolationField: case ErrorCode.WRN_UseDefViolationThis: case ErrorCode.WRN_UseDefViolationOut: case ErrorCode.WRN_UseDefViolation: case ErrorCode.WRN_SyncAndAsyncEntryPoints: case ErrorCode.WRN_ParameterIsStaticClass: case ErrorCode.WRN_ReturnTypeIsStaticClass: // Warning level 5 is exclusively for warnings introduced in the compiler // shipped with dotnet 5 (C# 9) and that can be reported for pre-existing code. return(5); case ErrorCode.WRN_InvalidMainSig: case ErrorCode.WRN_LowercaseEllSuffix: case ErrorCode.WRN_NewNotRequired: case ErrorCode.WRN_MainCantBeGeneric: case ErrorCode.WRN_ProtectedInSealed: case ErrorCode.WRN_UnassignedInternalField: case ErrorCode.WRN_MissingParamTag: case ErrorCode.WRN_MissingXMLComment: case ErrorCode.WRN_MissingTypeParamTag: case ErrorCode.WRN_InvalidVersionFormat: return(4); case ErrorCode.WRN_UnreferencedEvent: case ErrorCode.WRN_DuplicateUsing: case ErrorCode.WRN_UnreferencedVar: case ErrorCode.WRN_UnreferencedField: case ErrorCode.WRN_UnreferencedVarAssg: case ErrorCode.WRN_UnreferencedLocalFunction: case ErrorCode.WRN_SequentialOnPartialClass: case ErrorCode.WRN_UnreferencedFieldAssg: case ErrorCode.WRN_AmbiguousXMLReference: case ErrorCode.WRN_PossibleMistakenNullStatement: case ErrorCode.WRN_EqualsWithoutGetHashCode: case ErrorCode.WRN_EqualityOpWithoutEquals: case ErrorCode.WRN_EqualityOpWithoutGetHashCode: case ErrorCode.WRN_IncorrectBooleanAssg: case ErrorCode.WRN_BitwiseOrSignExtend: case ErrorCode.WRN_TypeParameterSameAsOuterTypeParameter: case ErrorCode.WRN_InvalidAssemblyName: case ErrorCode.WRN_UnifyReferenceBldRev: case ErrorCode.WRN_AssignmentToSelf: case ErrorCode.WRN_ComparisonToSelf: case ErrorCode.WRN_IsDynamicIsConfusing: case ErrorCode.WRN_DebugFullNameTooLong: case ErrorCode.WRN_PdbLocalNameTooLong: case ErrorCode.WRN_RecordEqualsWithoutGetHashCode: return(3); case ErrorCode.WRN_NewRequired: case ErrorCode.WRN_NewOrOverrideExpected: case ErrorCode.WRN_UnreachableCode: case ErrorCode.WRN_UnreferencedLabel: case ErrorCode.WRN_NegativeArrayIndex: case ErrorCode.WRN_BadRefCompareLeft: case ErrorCode.WRN_BadRefCompareRight: case ErrorCode.WRN_PatternIsAmbiguous: case ErrorCode.WRN_PatternNotPublicOrNotInstance: case ErrorCode.WRN_PatternBadSignature: case ErrorCode.WRN_SameFullNameThisNsAgg: case ErrorCode.WRN_SameFullNameThisAggAgg: case ErrorCode.WRN_SameFullNameThisAggNs: case ErrorCode.WRN_GlobalAliasDefn: case ErrorCode.WRN_AlwaysNull: case ErrorCode.WRN_CmpAlwaysFalse: case ErrorCode.WRN_GotoCaseShouldConvert: case ErrorCode.WRN_NubExprIsConstBool: case ErrorCode.WRN_ExplicitImplCollision: case ErrorCode.WRN_DeprecatedSymbolStr: case ErrorCode.WRN_VacuousIntegralComp: case ErrorCode.WRN_AssignmentToLockOrDispose: case ErrorCode.WRN_DeprecatedCollectionInitAddStr: case ErrorCode.WRN_DeprecatedCollectionInitAdd: case ErrorCode.WRN_DuplicateParamTag: case ErrorCode.WRN_UnmatchedParamTag: case ErrorCode.WRN_UnprocessedXMLComment: case ErrorCode.WRN_InvalidSearchPathDir: case ErrorCode.WRN_UnifyReferenceMajMin: case ErrorCode.WRN_DuplicateTypeParamTag: case ErrorCode.WRN_UnmatchedTypeParamTag: case ErrorCode.WRN_UnmatchedParamRefTag: case ErrorCode.WRN_UnmatchedTypeParamRefTag: case ErrorCode.WRN_CantHaveManifestForModule: case ErrorCode.WRN_DynamicDispatchToConditionalMethod: case ErrorCode.WRN_NoSources: case ErrorCode.WRN_CLS_MeaninglessOnPrivateType: case ErrorCode.WRN_CLS_AssemblyNotCLS2: case ErrorCode.WRN_MainIgnored: case ErrorCode.WRN_UnqualifiedNestedTypeInCref: case ErrorCode.WRN_NoRuntimeMetadataVersion: return(2); case ErrorCode.WRN_IsAlwaysTrue: case ErrorCode.WRN_IsAlwaysFalse: case ErrorCode.WRN_ByRefNonAgileField: case ErrorCode.WRN_VolatileByRef: case ErrorCode.WRN_FinalizeMethod: case ErrorCode.WRN_DeprecatedSymbol: case ErrorCode.WRN_ExternMethodNoImplementation: case ErrorCode.WRN_AttributeLocationOnBadDeclaration: case ErrorCode.WRN_InvalidAttributeLocation: case ErrorCode.WRN_NonObsoleteOverridingObsolete: case ErrorCode.WRN_CoClassWithoutComImport: case ErrorCode.WRN_ObsoleteOverridingNonObsolete: case ErrorCode.WRN_ExternCtorNoImplementation: case ErrorCode.WRN_WarningDirective: case ErrorCode.WRN_UnreachableGeneralCatch: case ErrorCode.WRN_DefaultValueForUnconsumedLocation: case ErrorCode.WRN_EmptySwitch: case ErrorCode.WRN_XMLParseError: case ErrorCode.WRN_BadXMLRef: case ErrorCode.WRN_BadXMLRefParamType: case ErrorCode.WRN_BadXMLRefReturnType: case ErrorCode.WRN_BadXMLRefSyntax: case ErrorCode.WRN_FailedInclude: case ErrorCode.WRN_InvalidInclude: case ErrorCode.WRN_XMLParseIncludeError: case ErrorCode.WRN_ALinkWarn: case ErrorCode.WRN_AssemblyAttributeFromModuleIsOverridden: case ErrorCode.WRN_CmdOptionConflictsSource: case ErrorCode.WRN_IllegalPragma: case ErrorCode.WRN_IllegalPPWarning: case ErrorCode.WRN_BadRestoreNumber: case ErrorCode.WRN_NonECMAFeature: case ErrorCode.WRN_ErrorOverride: case ErrorCode.WRN_MultiplePredefTypes: case ErrorCode.WRN_TooManyLinesForDebugger: case ErrorCode.WRN_CallOnNonAgileField: case ErrorCode.WRN_InvalidNumber: case ErrorCode.WRN_IllegalPPChecksum: case ErrorCode.WRN_EndOfPPLineExpected: case ErrorCode.WRN_ConflictingChecksum: case ErrorCode.WRN_DotOnDefault: case ErrorCode.WRN_BadXMLRefTypeVar: case ErrorCode.WRN_ReferencedAssemblyReferencesLinkedPIA: case ErrorCode.WRN_MultipleRuntimeImplementationMatches: case ErrorCode.WRN_MultipleRuntimeOverrideMatches: case ErrorCode.WRN_FileAlreadyIncluded: case ErrorCode.WRN_NoConfigNotOnCommandLine: case ErrorCode.WRN_AnalyzerCannotBeCreated: case ErrorCode.WRN_NoAnalyzerInAssembly: case ErrorCode.WRN_UnableToLoadAnalyzer: case ErrorCode.WRN_DefineIdentifierRequired: case ErrorCode.WRN_CLS_NoVarArgs: case ErrorCode.WRN_CLS_BadArgType: case ErrorCode.WRN_CLS_BadReturnType: case ErrorCode.WRN_CLS_BadFieldPropType: case ErrorCode.WRN_CLS_BadIdentifierCase: case ErrorCode.WRN_CLS_OverloadRefOut: case ErrorCode.WRN_CLS_OverloadUnnamed: case ErrorCode.WRN_CLS_BadIdentifier: case ErrorCode.WRN_CLS_BadBase: case ErrorCode.WRN_CLS_BadInterfaceMember: case ErrorCode.WRN_CLS_NoAbstractMembers: case ErrorCode.WRN_CLS_NotOnModules: case ErrorCode.WRN_CLS_ModuleMissingCLS: case ErrorCode.WRN_CLS_AssemblyNotCLS: case ErrorCode.WRN_CLS_BadAttributeType: case ErrorCode.WRN_CLS_ArrayArgumentToAttribute: case ErrorCode.WRN_CLS_NotOnModules2: case ErrorCode.WRN_CLS_IllegalTrueInFalse: case ErrorCode.WRN_CLS_MeaninglessOnParam: case ErrorCode.WRN_CLS_MeaninglessOnReturn: case ErrorCode.WRN_CLS_BadTypeVar: case ErrorCode.WRN_CLS_VolatileField: case ErrorCode.WRN_CLS_BadInterface: case ErrorCode.WRN_UnobservedAwaitableExpression: case ErrorCode.WRN_CallerLineNumberParamForUnconsumedLocation: case ErrorCode.WRN_CallerFilePathParamForUnconsumedLocation: case ErrorCode.WRN_CallerMemberNameParamForUnconsumedLocation: case ErrorCode.WRN_CallerFilePathPreferredOverCallerMemberName: case ErrorCode.WRN_CallerLineNumberPreferredOverCallerMemberName: case ErrorCode.WRN_CallerLineNumberPreferredOverCallerFilePath: case ErrorCode.WRN_DelaySignButNoKey: case ErrorCode.WRN_UnimplementedCommandLineSwitch: case ErrorCode.WRN_AsyncLacksAwaits: case ErrorCode.WRN_BadUILang: case ErrorCode.WRN_RefCultureMismatch: case ErrorCode.WRN_ConflictingMachineAssembly: case ErrorCode.WRN_FilterIsConstantTrue: case ErrorCode.WRN_FilterIsConstantFalse: case ErrorCode.WRN_FilterIsConstantFalseRedundantTryCatch: case ErrorCode.WRN_IdentifierOrNumericLiteralExpected: case ErrorCode.WRN_ReferencedAssemblyDoesNotHaveStrongName: case ErrorCode.WRN_AlignmentMagnitude: case ErrorCode.WRN_AttributeIgnoredWhenPublicSigning: case ErrorCode.WRN_TupleLiteralNameMismatch: case ErrorCode.WRN_Experimental: case ErrorCode.WRN_AttributesOnBackingFieldsNotAvailable: case ErrorCode.WRN_TupleBinopLiteralNameMismatch: case ErrorCode.WRN_TypeParameterSameAsOuterMethodTypeParameter: case ErrorCode.WRN_ConvertingNullableToNonNullable: case ErrorCode.WRN_NullReferenceAssignment: case ErrorCode.WRN_NullReferenceReceiver: case ErrorCode.WRN_NullReferenceReturn: case ErrorCode.WRN_NullReferenceArgument: case ErrorCode.WRN_NullabilityMismatchInTypeOnOverride: case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride: case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial: case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride: case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial: case ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation: case ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation: case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation: case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation: case ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList: case ErrorCode.WRN_NullabilityMismatchInInterfaceImplementedByBase: case ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface: case ErrorCode.WRN_NullabilityMismatchInTypeOnExplicitImplementation: case ErrorCode.WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation: case ErrorCode.WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation: case ErrorCode.WRN_UninitializedNonNullableField: case ErrorCode.WRN_NullabilityMismatchInAssignment: case ErrorCode.WRN_NullabilityMismatchInArgument: case ErrorCode.WRN_NullabilityMismatchInArgumentForOutput: case ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate: case ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate: case ErrorCode.WRN_NullAsNonNullable: case ErrorCode.WRN_NullableValueTypeMayBeNull: case ErrorCode.WRN_NullabilityMismatchInTypeParameterConstraint: case ErrorCode.WRN_MissingNonNullTypesContextForAnnotation: case ErrorCode.WRN_MissingNonNullTypesContextForAnnotationInGeneratedCode: case ErrorCode.WRN_NullabilityMismatchInConstraintsOnImplicitImplementation: case ErrorCode.WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint: case ErrorCode.WRN_SwitchExpressionNotExhaustive: case ErrorCode.WRN_IsTypeNamedUnderscore: case ErrorCode.WRN_GivenExpressionNeverMatchesPattern: case ErrorCode.WRN_GivenExpressionAlwaysMatchesConstant: case ErrorCode.WRN_SwitchExpressionNotExhaustiveWithUnnamedEnumValue: case ErrorCode.WRN_CaseConstantNamedUnderscore: case ErrorCode.WRN_ThrowPossibleNull: case ErrorCode.WRN_UnboxPossibleNull: case ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull: case ErrorCode.WRN_ImplicitCopyInReadOnlyMember: case ErrorCode.WRN_UnconsumedEnumeratorCancellationAttributeUsage: case ErrorCode.WRN_UndecoratedCancellationTokenParameter: case ErrorCode.WRN_NullabilityMismatchInTypeParameterNotNullConstraint: case ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment: case ErrorCode.WRN_ParameterConditionallyDisallowsNull: case ErrorCode.WRN_NullReferenceInitializer: case ErrorCode.WRN_ShouldNotReturn: case ErrorCode.WRN_DoesNotReturnMismatch: case ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride: case ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride: case ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation: case ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation: case ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation: case ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation: case ErrorCode.WRN_ConstOutOfRangeChecked: case ErrorCode.WRN_MemberNotNull: case ErrorCode.WRN_MemberNotNullBadMember: case ErrorCode.WRN_MemberNotNullWhen: case ErrorCode.WRN_GeneratorFailedDuringInitialization: case ErrorCode.WRN_GeneratorFailedDuringGeneration: case ErrorCode.WRN_ParameterDisallowsNull: case ErrorCode.WRN_GivenExpressionAlwaysMatchesPattern: case ErrorCode.WRN_IsPatternAlways: case ErrorCode.WRN_SwitchExpressionNotExhaustiveWithWhen: case ErrorCode.WRN_SwitchExpressionNotExhaustiveForNullWithWhen: case ErrorCode.WRN_RecordNamedDisallowed: case ErrorCode.WRN_ParameterNotNullIfNotNull: case ErrorCode.WRN_ReturnNotNullIfNotNull: case ErrorCode.WRN_AnalyzerReferencesFramework: return(1); default: return(0); } // Note: when adding a warning here, consider whether it should be registered as a nullability warning too }
public override void ReportError(ErrorCode errorCode, string message, string file, int lineNumber) { Console.WriteLine("PhysX: " + message); }
public static LocalizableResourceString GetDescription(ErrorCode code) { return(new LocalizableResourceString(code.ToString() + s_descriptionSuffix, ResourceManager, typeof(ErrorFacts))); }
public Error(ErrorCode code) { Code = code; reason = null; }
public static LocalizableResourceString GetMessageFormat(ErrorCode code) { return(new LocalizableResourceString(code.ToString(), ResourceManager, typeof(ErrorFacts))); }
/// <remarks> /// Internal for testing. /// </remarks> internal static ImmutableArray <AssemblyIdentity> GetMissingAssemblyIdentitiesHelper(ErrorCode code, IReadOnlyList <object> arguments, AssemblyIdentity linqLibrary) { Debug.Assert(linqLibrary != null); switch (code) { case ErrorCode.ERR_NoTypeDef: case ErrorCode.ERR_GlobalSingleTypeNameNotFoundFwd: case ErrorCode.ERR_DottedTypeNameNotFoundInNSFwd: case ErrorCode.ERR_SingleTypeNameNotFoundFwd: case ErrorCode.ERR_NameNotInContextPossibleMissingReference: // Probably can't happen. foreach (var argument in arguments) { var identity = (argument as AssemblyIdentity) ?? (argument as AssemblySymbol)?.Identity; if (identity != null && !identity.Equals(MissingCorLibrarySymbol.Instance.Identity)) { return(ImmutableArray.Create(identity)); } } break; case ErrorCode.ERR_DottedTypeNameNotFoundInNS: if (arguments.Count == 2) { var namespaceName = arguments[0] as string; var containingNamespace = arguments[1] as NamespaceSymbol; if (namespaceName != null && (object)containingNamespace != null && containingNamespace.ConstituentNamespaces.Any(n => n.ContainingAssembly.Identity.IsWindowsAssemblyIdentity())) { // This is just a heuristic, but it has the advantage of being portable, particularly // across different versions of (desktop) windows. var identity = new AssemblyIdentity($"{containingNamespace.ToDisplayString()}.{namespaceName}", contentType: System.Reflection.AssemblyContentType.WindowsRuntime); return(ImmutableArray.Create(identity)); } } break; case ErrorCode.ERR_NoSuchMemberOrExtension: // Commonly, but not always, caused by absence of System.Core. case ErrorCode.ERR_DynamicAttributeMissing: case ErrorCode.ERR_DynamicRequiredTypesMissing: // MSDN says these might come from System.Dynamic.Runtime case ErrorCode.ERR_QueryNoProviderStandard: case ErrorCode.ERR_ExtensionAttrNotFound: // Probably can't happen. return(ImmutableArray.Create(linqLibrary)); case ErrorCode.ERR_BadAwaitArg_NeedSystem: Debug.Assert(false, "Roslyn no longer produces ERR_BadAwaitArg_NeedSystem"); break; } return(default(ImmutableArray <AssemblyIdentity>)); }
public Error(ErrorCode code, string reason) { Code = code; this.reason = reason; }
public FieldValidationError(IReadOnlyDictionary <string, string> fieldErrors, ErrorCode code = ErrorCode.FieldValidation) : base(ErrorType.ValidationError.ToString(), "Request validation failed.", (int)code, fieldErrors) { if (!fieldErrors.Any()) { throw new ArgumentException("You must give at least one field error.", nameof(fieldErrors)); } }
public InvalidResourceException(string message, Response response, ErrorCode errorCode) : base(message, response, errorCode) { }