Skip to content

Commit 9c65609

Browse files
committed
Bad servername.cache.bin make server to not start
Bad servername.cache.bin make server to not start NuGet/NuGetGallery#2985
1 parent ae30d11 commit 9c65609

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/NuGet.Server/Infrastructure/ServerPackageStore.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Runtime.Serialization;
99
using System.Threading;
1010
using System.Threading.Tasks;
11+
using Newtonsoft.Json;
1112

1213
namespace NuGet.Server.Infrastructure
1314
{
@@ -53,10 +54,17 @@ private void Load()
5354
}
5455
}
5556
}
56-
catch (SerializationException)
57+
catch (Exception ex)
5758
{
58-
// In case this happens, remove the file
59-
_fileSystem.DeleteFile(_fileName);
59+
if (ex is JsonReaderException || ex is SerializationException)
60+
{
61+
// In case this happens, remove the file
62+
_fileSystem.DeleteFile(_fileName);
63+
}
64+
else
65+
{
66+
throw;
67+
}
6068
}
6169
}
6270
}

0 commit comments

Comments
 (0)