Skip to content

Commit 9a77667

Browse files
committed
Change exceptions raised, addresses CA1065.
1 parent 1dd686f commit 9a77667

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Rubberduck.Core/UI/Inspections/AggregateInspectionResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public AggregateInspectionResult(IInspectionResult firstResult, int count)
2727

2828
public ParserRuleContext Context => _result.Context;
2929

30-
public dynamic Properties => throw new NotImplementedException();
30+
public dynamic Properties => throw new InvalidOperationException();
3131

3232
public int CompareTo(IInspectionResult other)
3333
{

Rubberduck.UnitTesting/ComClientHelpers/PermissiveObjectComparer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public class PermissiveObjectComparer : IEqualityComparer<object>
5656
/// </summary>
5757
/// <param name="obj"></param>
5858
/// <returns>NotSupportedException</returns>
59+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065")] // see comment below.
5960
public int GetHashCode(object obj)
6061
{
6162
//This is intentional to "discourage" any use of the comparer that relies on GetHashCode().

Rubberduck.VBEEditor/ComManagement/TypeLibs/TypeLibs.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public bool CompileProject()
252252
{
253253
if (!HasVBEExtensions)
254254
{
255-
throw new ArgumentException("This TypeLib does not represent a VBE project, so we cannot compile it");
255+
throw new InvalidOperationException("This TypeLib does not represent a VBE project, so we cannot compile it");
256256
}
257257

258258
try
@@ -266,7 +266,7 @@ public bool CompileProject()
266266
if (e.HResult != (int)KnownComHResults.E_VBA_COMPILEERROR)
267267
{
268268
// this is for debug purposes, to see if the compiler ever returns other errors on failure
269-
throw new ArgumentException("Unrecognised VBE compiler error: \n" + e.ToString());
269+
throw new InvalidOperationException("Unrecognised VBE compiler error: \n" + e.ToString());
270270
}
271271
#endif
272272
return false;
@@ -283,7 +283,7 @@ public string ConditionalCompilationArgumentsRaw
283283
{
284284
if (!HasVBEExtensions)
285285
{
286-
throw new ArgumentException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
286+
throw new InvalidOperationException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
287287
}
288288

289289
return target_IVBEProject.GetConditionalCompilationArgs();
@@ -293,7 +293,7 @@ public string ConditionalCompilationArgumentsRaw
293293
{
294294
if (!HasVBEExtensions)
295295
{
296-
throw new ArgumentException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
296+
throw new InvalidOperationException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
297297
}
298298

299299
target_IVBEProject.SetConditionalCompilationArgs(value);
@@ -310,7 +310,7 @@ public Dictionary<string, short> ConditionalCompilationArguments
310310
{
311311
if (!HasVBEExtensions)
312312
{
313-
throw new ArgumentException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
313+
throw new InvalidOperationException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
314314
}
315315

316316
string args = target_IVBEProject.GetConditionalCompilationArgs();
@@ -330,7 +330,7 @@ public Dictionary<string, short> ConditionalCompilationArguments
330330
{
331331
if (!HasVBEExtensions)
332332
{
333-
throw new ArgumentException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
333+
throw new InvalidOperationException("This ITypeLib is not hosted by the VBE, so does not support ConditionalCompilationArguments");
334334
}
335335

336336
var rawArgsString = string.Join(" : ", value.Select(x => x.Key + " = " + x.Value));

0 commit comments

Comments
 (0)