I have a C # project like "console", it launches its own application domain into it from the parent application, and it creates a console window. However, any text written to the console is not displayed. Console.ReadKey() really works. Any ideas what could be wrong?
Note. Echo for the parent process is displayed in the built-in console of the parent process (which is not a win32 console, but some DirectX GUI widget) Console.Out and System.Console.Out are not a "zero" thread.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using ParentApi; namespace LSTest4 { class Program { static void Main(string[] args) { Console.OpenStandardOutput(); ParentApi.Echo(System.Console.Out.ToString()); Console.Out.WriteLine("monkeys"); Console.WriteLine("app start"); Console.Write("lalala"); Console.ReadKey(); ParentApi.Echo("app start"); } }
change
After further research:
This code is injected into another application, the injection is hostile and controlled by "ParentApi", and it seems that the purpose of the injection is to reassign the standard threads. In this case, it is best to ensure that the trace is processed in some other way. I could use WCF to output the trace output to an external process.
source share