15,902,933 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Nishant2852 (Top 3 by date)
Nishant2852
25-Sep-15 5:32am
View
When i put code in thread than it doesnt throw any error. when i put code outside of thread it throws below error.
Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Users\Windows\Desktop\Test\WorkHives\WorkHives\bin\Debug\WorkHives.vshost.exe'.
Additional information: The CLR has been unable to transition from COM context 0x1068ff0 to COM context 0x10690a8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
Nishant2852
25-Sep-15 5:26am
View
I have also tried this..but able to solve error.
here is my code..
Private Sub bgWorker_DoWork(sender As Object, e As DoWorkEventArgs) Handles bgWorker.DoWork
Dim fi As New System.IO.FileInfo(OpenFileDialog1.FileName)
If fi.Length > 5000 Then
thrdFile = New Thread(AddressOf UploadFile)
thrdFile.SetApartmentState(ApartmentState.STA)
thrdFile.IsBackground = True
thrdFile.Start()
Else
UploadFile()
End If
Dim cnt_temp As Integer = 1
pBar.Maximum = 100
While thrdFile.IsAlive = True
System.Threading.Thread.Sleep(500)
cnt_temp = cnt_temp + 1
If cnt_temp > pBar.Maximum Then
cnt_temp = 1
End If
bgWorker.ReportProgress(cnt_temp)
End While
End Sub
Nishant2852
24-Sep-15 9:46am
View
Deleted
I have two Function.. AmazonS3 Client, Filename , Path, and Str3_Key for amazon
here is the code
Public Sub CreateNewFile(client As AmazonS3, filename As String, filepath As String, strs3_key As String)
Try
Cursor.Current = Cursors.WaitCursor
Dim S3_KEY As [String] = strs3_key
Dim request As New PutObjectRequest()
request.WithBucketName(amazon_bucket_name)
request.WithKey(S3_KEY)
request.WithContentBody("")
client.PutObject(request)
UploadFile(client, S3_KEY, filepath)
Cursor.Current = Cursors.Default
Catch ex As Exception
Cursor.Current = Cursors.Default
MessageBox.Show(ReadException(ex))
End Try
End Sub
Public Shared Sub UploadFile(client As AmazonS3, S3_key As String, FilePath As String)
Try
Dim request As New PutObjectRequest()
request.WithBucketName(amazon_bucket_name)
request.WithKey(S3_key)
request.WithFilePath(FilePath)
client.PutObject(request)
Catch ex As Exception
End Try
End Sub