15,913,758 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 Greggo (Top 2 by date)
Greggo
24-Nov-20 14:07pm
View
This made a difference, but 2 problems remain:
The CreateFileW function call consistently results in an exception with this message:
"An unhandled exception of type 'System.AccessViolationException' occurred in WorkingCodeCS.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
The other problem is that the call to ClearCommError (hSerial, out dwErrorFlags, out comstat) always returns a comstat.cbInQue value of 0, while in the C++ code this call worked properly and always returned a non-zero value when there was data to be retrieved.
Greggo
14-Nov-20 19:41pm
View
Because I've tried and haven't been able to get it to work. Also because I already have C++ code that has been proven to be reliable and see no reason why I shouldn't be able to port it to C# using P/Invoke, and because after that porting everything works EXCEPT for ReadFile. That's why not.