Skip to content

Commit 4155b70

Browse files
committed
Replace Task.Factory.StartNew with Task.Run
1 parent c49112c commit 4155b70

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

ClientCore/INIProcessing/PreprocessorBackgroundTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static PreprocessorBackgroundTask Instance
3333

3434
public void Run()
3535
{
36-
task = Task.Factory.StartNew(CheckFiles);
36+
task = Task.Run(CheckFiles);
3737
}
3838

3939
private static void CheckFiles()

DXMainClient/DXGUI/Generic/GameInProgressWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void HandleGameProcessExited()
167167

168168
if (ClientConfiguration.Instance.ClientGameType == ClientType.Ares)
169169
{
170-
Task.Factory.StartNew(ProcessScreenshots);
170+
Task.Run(ProcessScreenshots);
171171

172172
// TODO: Ares debug log handling should be addressed in Ares DLL itself.
173173
// For now the following are handled here:

DXMainClient/Domain/Multiplayer/MapLoader.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ private void LoadCustomMaps()
440440

441441
foreach (FileInfo mapFile in mapFiles)
442442
{
443-
// this must be Task.Factory.StartNew for XNA/.Net 4.0 compatibility
444-
tasks.Add(Task.Factory.StartNew(() =>
443+
tasks.Add(Task.Run(() =>
445444
{
446445
string baseFilePath = mapFile.FullName.Substring(ProgramConstants.GamePath.Length);
447446
baseFilePath = baseFilePath.Substring(0, baseFilePath.Length - 4);

DXMainClient/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ public void Execute()
6767
onlineIdThread.Start();
6868

6969
if (ClientConfiguration.Instance.ClientGameType == ClientType.Ares)
70-
Task.Factory.StartNew(() => PruneFiles(SafePath.GetDirectory(ProgramConstants.GamePath, "debug"), DateTime.Now.AddDays(-7)));
70+
Task.Run(() => PruneFiles(SafePath.GetDirectory(ProgramConstants.GamePath, "debug"), DateTime.Now.AddDays(-7)));
7171

72-
Task.Factory.StartNew(MigrateOldLogFiles);
72+
Task.Run(MigrateOldLogFiles);
7373

7474
DirectoryInfo updaterFolder = SafePath.GetDirectory(ProgramConstants.GamePath, "Updater");
7575

0 commit comments

Comments
 (0)