From 8114eac3f7586ea3de41e69b697334e791203a4d Mon Sep 17 00:00:00 2001
From: Stephen Shaw <sshaw@decriptor.com>
Date: Fri, 24 Nov 2023 21:39:31 -0700
Subject: [PATCH 1/4] Move net6 to net8 and enable a couple build items

This moves to net8 the latest LTS version from Microsoft.

Also enables:
* NETAnalyzers
* Deterministic builds
* Global TreatWarningsAsErrors
---
 Directory.Build.props                         | 10 +++++--
 src/TaglibSharp/CorruptFileException.cs       | 25 -----------------
 src/TaglibSharp/File.cs                       | 19 -------------
 src/TaglibSharp/Riff/List.cs                  | 27 -------------------
 src/TaglibSharp/TaglibSharp.csproj            |  1 -
 src/TaglibSharp/UnsupportedFormatException.cs | 27 +------------------
 6 files changed, 9 insertions(+), 100 deletions(-)

diff --git a/Directory.Build.props b/Directory.Build.props
index e489b3ebc..178b8bd95 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,9 +6,15 @@
     <RepositoryType>git</RepositoryType>
 
     <!-- Make sure to update Directory.Build.targets too! -->
-    <ExeTargetFrameworks>net6.0;net472</ExeTargetFrameworks>
-    <LibTargetFrameworks>net6.0;netstandard2.0</LibTargetFrameworks>
+    <ExeTargetFrameworks>net8.0;net472</ExeTargetFrameworks>
+    <LibTargetFrameworks>net8.0;netstandard2.0</LibTargetFrameworks>
+  </PropertyGroup>
+
+  <PropertyGroup>
+    <EnableNETAnalyzers>true</EnableNETAnalyzers>
     <LangVersion>latest</LangVersion>
+    <Deterministic>true</Deterministic>
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
 
 </Project>
diff --git a/src/TaglibSharp/CorruptFileException.cs b/src/TaglibSharp/CorruptFileException.cs
index f5f6010b8..b66545154 100644
--- a/src/TaglibSharp/CorruptFileException.cs
+++ b/src/TaglibSharp/CorruptFileException.cs
@@ -25,7 +25,6 @@
 //
 
 using System;
-using System.Runtime.Serialization;
 
 namespace TagLib
 {
@@ -98,7 +97,6 @@ namespace TagLib
 	/// 	Console.WriteLine ("That file is corrupt: {0}", e.ToString ());
 	///    </code>
 	/// </example>
-	[Serializable]
 	public class CorruptFileException : Exception
 	{
 		/// <summary>
@@ -140,28 +138,5 @@ public CorruptFileException (string message, Exception innerException)
 			: base (message, innerException)
 		{
 		}
-
-		/// <summary>
-		///    Constructs and initializes a new instance of <see
-		///    cref="CorruptFileException" /> from a specified
-		///    serialization info and streaming context.
-		/// </summary>
-		/// <param name="info">
-		///    A <see cref="SerializationInfo" /> object containing the
-		///    serialized data to be used for the new instance.
-		/// </param>
-		/// <param name="context">
-		///    A <see cref="StreamingContext" /> object containing the
-		///    streaming context information for the new instance.
-		/// </param>
-		/// <remarks>
-		///    This constructor is implemented because <see
-		///    cref="CorruptFileException" /> implements the <see
-		///    cref="ISerializable" /> interface.
-		/// </remarks>
-		protected CorruptFileException (SerializationInfo info, StreamingContext context)
-			: base (info, context)
-		{
-		}
 	}
 }
\ No newline at end of file
diff --git a/src/TaglibSharp/File.cs b/src/TaglibSharp/File.cs
index 40f691c69..41388b771 100644
--- a/src/TaglibSharp/File.cs
+++ b/src/TaglibSharp/File.cs
@@ -32,7 +32,6 @@
 using System.Collections.Generic;
 using System.Globalization;
 using System.IO;
-using System.Runtime.Serialization;
 
 namespace TagLib
 {
@@ -1299,7 +1298,6 @@ public static File Create (IFileAbstraction abstraction, string mimetype, ReadSt
 				file.MimeType = mimetype;
 				return file;
 			} catch (System.Reflection.TargetInvocationException e) {
-				PrepareExceptionForRethrow (e.InnerException);
 				throw e.InnerException;
 			}
 		}
@@ -1505,25 +1503,8 @@ protected void Truncate (long length)
 			Mode = old_mode;
 		}
 
-		/// <summary>
-		/// Causes the original strack trace of the exception to be preserved when it is rethrown
-		/// </summary>
-		/// <param name="ex"></param>
-		static void PrepareExceptionForRethrow (Exception ex)
-		{
-			var ctx = new StreamingContext (StreamingContextStates.CrossAppDomain);
-			var mgr = new ObjectManager (null, ctx);
-			var si = new SerializationInfo (ex.GetType (), new FormatterConverter ());
-
-			ex.GetObjectData (si, ctx);
-			mgr.RegisterObject (ex, 1, si); // prepare for SetObjectData
-			mgr.DoFixups (); // ObjectManager calls SetObjectData
-		}
-
 		#endregion
 
-
-
 		#region Classes
 
 		/// <summary>
diff --git a/src/TaglibSharp/Riff/List.cs b/src/TaglibSharp/Riff/List.cs
index 2f762e554..edd75b101 100644
--- a/src/TaglibSharp/Riff/List.cs
+++ b/src/TaglibSharp/Riff/List.cs
@@ -24,8 +24,6 @@
 using System;
 using System.Collections.Generic;
 using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
 
 namespace TagLib.Riff
 {
@@ -34,8 +32,6 @@ namespace TagLib.Riff
 	///    cref="T:System.Collections.Generic.Dictionary`2" /> to provide
 	///    support for reading and writing RIFF lists.
 	/// </summary>
-	[Serializable]
-	[ComVisible (false)]
 	public class List : Dictionary<ByteVector, ByteVectorCollection>
 	{
 
@@ -116,29 +112,6 @@ public List (TagLib.File file, long position, int length)
 			Parse (file.ReadBlock (length));
 		}
 
-		/// <summary>
-		///    Constructs and initializes a new instance of <see
-		///    cref="List" /> from a specified serialization info and
-		///    streaming context.
-		/// </summary>
-		/// <param name="info">
-		///    A <see cref="SerializationInfo" /> object containing the
-		///    serialized data to be used for the new instance.
-		/// </param>
-		/// <param name="context">
-		///    A <see cref="StreamingContext" /> object containing the
-		///    streaming context information for the new instance.
-		/// </param>
-		/// <remarks>
-		///    This constructor is implemented because <see
-		///    cref="List" /> implements the <see cref="ISerializable"
-		///    /> interface.
-		/// </remarks>
-		protected List (SerializationInfo info, StreamingContext context)
-			: base (info, context)
-		{
-		}
-
 		#endregion
 
 		#region Public Properties
diff --git a/src/TaglibSharp/TaglibSharp.csproj b/src/TaglibSharp/TaglibSharp.csproj
index a7c94efc3..1b48835f5 100644
--- a/src/TaglibSharp/TaglibSharp.csproj
+++ b/src/TaglibSharp/TaglibSharp.csproj
@@ -9,7 +9,6 @@
     <SignAssembly>true</SignAssembly>
     <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
     <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
-    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <IncludeSymbols>true</IncludeSymbols>
     <SymbolPackageFormat>snupkg</SymbolPackageFormat>
   </PropertyGroup>
diff --git a/src/TaglibSharp/UnsupportedFormatException.cs b/src/TaglibSharp/UnsupportedFormatException.cs
index bf2a0cbba..df95fe3f8 100644
--- a/src/TaglibSharp/UnsupportedFormatException.cs
+++ b/src/TaglibSharp/UnsupportedFormatException.cs
@@ -25,7 +25,6 @@
 //
 
 using System;
-using System.Runtime.Serialization;
 
 namespace TagLib
 {
@@ -93,7 +92,6 @@ namespace TagLib
 	/// 	Console.WriteLine ("That file format is not supported: {0}", e.ToString ());
 	///    </code>
 	/// </example>
-	[Serializable]
 	public class UnsupportedFormatException : Exception
 	{
 		/// <summary>
@@ -136,28 +134,5 @@ public UnsupportedFormatException (string message, Exception innerException)
 			: base (message, innerException)
 		{
 		}
-
-		/// <summary>
-		///    Constructs and initializes a new instance of <see
-		///    cref="UnsupportedFormatException" /> from a specified
-		///    serialization info and streaming context.
-		/// </summary>
-		/// <param name="info">
-		///    A <see cref="SerializationInfo" /> object containing the
-		///    serialized data to be used for the new instance.
-		/// </param>
-		/// <param name="context">
-		///    A <see cref="StreamingContext" /> object containing the
-		///    streaming context information for the new instance.
-		/// </param>
-		/// <remarks>
-		///    This constructor is implemented because <see
-		///    cref="UnsupportedFormatException" /> implements the <see
-		///    cref="ISerializable" /> interface.
-		/// </remarks>
-		protected UnsupportedFormatException (SerializationInfo info, StreamingContext context)
-			: base (info, context)
-		{
-		}
 	}
-}
\ No newline at end of file
+}

From 3b8c2d66d1d29b6defc96144cd3972faaa847b0c Mon Sep 17 00:00:00 2001
From: Stephen Shaw <sshaw@decriptor.com>
Date: Fri, 24 Nov 2023 21:42:47 -0700
Subject: [PATCH 2/4] Use the .gitignore from github for Visual Studio C#

Also added .idea for Project Rider
---
 .gitignore | 424 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 397 insertions(+), 27 deletions(-)

diff --git a/.gitignore b/.gitignore
index cd2609d8f..c40f76d03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,29 +1,399 @@
-INSTALL
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache/
-bin/
-obj/
-config.log
-config.status
-configure
-*.config
-install-sh
-missing
-*.pc
-*.zip
-*.dll
-*.pdb
-*.exe
-docs/*.xml
-docs/*/*
-docs/*.tree
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+.idea
+
+# User-specific files (MonoDevelop/Xamarin Studio)
 *.userprefs
-.*.swp
-packages
-.vs
-.DS_Store
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
 TestResult.xml
-src/TaglibSharp.Tests/samples/tmp*
-*.sln.DotSettings.user
\ No newline at end of file
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml

From 918eeea3b7b4f54afe3a24478778194f04b9efb0 Mon Sep 17 00:00:00 2001
From: Stephen Shaw <sshaw@decriptor.com>
Date: Fri, 24 Nov 2023 22:38:32 -0700
Subject: [PATCH 3/4] Bump build yml files to net 8.0.100

---
 .github/workflows/mac.yml     | 2 +-
 .github/workflows/ubuntu.yml  | 2 +-
 .github/workflows/windows.yml | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml
index 3be3c3b56..2870a3ca0 100644
--- a/.github/workflows/mac.yml
+++ b/.github/workflows/mac.yml
@@ -18,7 +18,7 @@ jobs:
     - name: Setup .NET Core
       uses: actions/setup-dotnet@v1
       with:
-        dotnet-version: 6.0.302
+        dotnet-version: 8.0.100
     - name: Build with dotnet
       run: dotnet build --configuration Release
     - name: Run unit tests
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index bb0cde499..05eacd31e 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -18,7 +18,7 @@ jobs:
     - name: Setup .NET Core
       uses: actions/setup-dotnet@v1
       with:
-        dotnet-version: 6.0.302
+        dotnet-version: 8.0.100
     - name: Build with dotnet
       run: dotnet build --configuration Release
     - name: Run unit tests
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index 367e0103c..761edb42f 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -18,7 +18,7 @@ jobs:
     - name: Setup .NET Core
       uses: actions/setup-dotnet@v1
       with:
-        dotnet-version: 6.0.302
+        dotnet-version: 8.0.100
 
     - name: Clean
       run: dotnet clean --configuration Release && dotnet nuget locals all --clear

From e794bcabf9a9e94fab1d089e621f0e99c43aaaca Mon Sep 17 00:00:00 2001
From: Stephen Shaw <sshaw@decriptor.com>
Date: Fri, 24 Nov 2023 22:39:33 -0700
Subject: [PATCH 4/4] Add TaglibSharp.Tests samples to gitignore

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index c40f76d03..39a482961 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 *.userosscache
 *.sln.docstates
 .idea
+src/TaglibSharp.Tests/samples
 
 # User-specific files (MonoDevelop/Xamarin Studio)
 *.userprefs