Jump to content

Bug with start/stop thread


79135

Recommended Posts

[E] 21:59:55 - Quester.Bot > Pulse(): System.IO.IOException: Процесс не может получить доступ к файлу "D:\BOTs\WRobot 3.3.5\Profiles\Quester\Cache\A.xml.cs", так как этот файл используется другим процессом.
   в System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   в System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   в System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   в System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   в System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   в System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   в System.IO.File.WriteAllText(String path, String contents)
   в Quester.Bot.Bot.Pulse(Boolean loadSettingsProfile, String profile)
21:59:55 - [Quester] Failed to start

 

After use the thread:

            Thread startStop = new Thread(() =>
            {
                robotManager.Products.Products.ProductStop();
                Thread.Sleep(1000);
                robotManager.Products.Products.ProductStart();
            });
            startStop.Start();
            Thread.Sleep(3000);
            startStop.Abort();

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...