Skip to content

Commit

Permalink
Supress obsolete warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreddy-work committed Jun 15, 2022
1 parent a1e2440 commit 564f1c1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ protected virtual Type GetType(IDesignerHost host, AssemblyName assemblyName, st
{
}

#pragma warning disable SYSLIB0044 // Type or member is obsolete. Ref https://github.com/dotnet/winforms/issues/7308
if (a is null && !string.IsNullOrEmpty(assemblyName.CodeBase))
{
try
Expand All @@ -649,6 +650,7 @@ protected virtual Type GetType(IDesignerHost host, AssemblyName assemblyName, st
{
}
}
#pragma warning restore SYSLIB0044 // Type or member is obsolete

if (a != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ public static IEnumerable<object[]> GetType_TestData()
yield return new object[] { null, new AssemblyName(typeof(ToolboxItemTests).Assembly.FullName), "NoSuchType", false, null };
yield return new object[] { null, null, string.Empty, false, null };

#pragma warning disable SYSLIB0044 // Type or member is obsolete
var validNameWithCodeBase = new AssemblyName(typeof(int).Assembly.FullName)
{
CodeBase = "System.Windows.Forms.Design.Tests.dll"
Expand Down Expand Up @@ -1249,6 +1250,7 @@ public static IEnumerable<object[]> GetType_TestData()
{
CodeBase = "ThrowIOException"
};
#pragma warning restore SYSLIB0044 // Type or member is obsolete
yield return new object[] { null, ioFormatExceptionCodeBase, "System.Int32", false, typeof(int) };
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ public Assembly GetAssembly(AssemblyName name, bool throwOnError)
[UnconditionalSuppressMessage("SingleFile", "IL3002", Justification = "Returns null if in a single file")]
public string GetPathOfAssembly(AssemblyName name)
{
#pragma warning disable SYSLIB0044 // Type or member is obsolete. Ref https://github.com/dotnet/winforms/issues/7308
return name.CodeBase;
#pragma warning restore SYSLIB0044 // Type or member is obsolete
}

public Type GetType(string name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public ThreadExceptionDialog(Exception t)
detailsTextBuilder.Append(newline);
detailsTextBuilder.Append(string.Format(CultureInfo.CurrentCulture, sectionseparator, SR.ExDlgMsgLoadedAssembliesSection));

#pragma warning disable SYSLIB0044 // Type or member is obsolete. Ref https://github.com/dotnet/winforms/issues/7308.
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
{
AssemblyName name = asm.GetName();
Expand All @@ -207,6 +208,7 @@ public ThreadExceptionDialog(Exception t)
detailsTextBuilder.Append(string.Format(SR.ExDlgMsgLoadedAssembliesEntry, name.Name, name.Version, fileVer, name.EscapedCodeBase));
detailsTextBuilder.Append(separator);
}
#pragma warning restore SYSLIB0044 // Type or member is obsolete

detailsTextBuilder.Append(string.Format(CultureInfo.CurrentCulture, sectionseparator, SR.ExDlgMsgJITDebuggingSection));
if (Application.CustomThreadExceptionHandlerAttached)
Expand Down

0 comments on commit 564f1c1

Please sign in to comment.