Visual Studio Community 2015 Console Application Error on St

本文关键字:Error on St Application Console Studio Community 2015 Visual | 更新日期: 2023-09-27 18:33:04

以下是错误:

'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_64'mscorlib'v4.0_4.0.0.0__b77a5c561934e089'mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'assembly'GAC_MSIL'Microsoft.VisualStudio.HostingProcess.Utilities'14.0.0.0__b03f5f7f11d50a3a'Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Windows.Forms'v4.0_4.0.0.0__b77a5c561934e089'System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System'v4.0_4.0.0.0__b77a5c561934e089'System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Drawing'v4.0_4.0.0.0__b03f5f7f11d50a3a'System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'assembly'GAC_MSIL'Microsoft.VisualStudio.HostingProcess.Utilities.Sync'14.0.0.0__b03f5f7f11d50a3a'Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'assembly'GAC_MSIL'Microsoft.VisualStudio.Debugger.Runtime'14.0.0.0__b03f5f7f11d50a3a'Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'Users'Chris James'Documents'Visual Studio 2015'Projects'ConsoleApplication3'ConsoleApplication3'bin'Debug'ConsoleApplication3.vshost.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Core'v4.0_4.0.0.0__b77a5c561934e089'System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Xml.Linq'v4.0_4.0.0.0__b77a5c561934e089'System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Data.DataSetExtensions'v4.0_4.0.0.0__b77a5c561934e089'System.Data.DataSetExtensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'Microsoft.CSharp'v4.0_4.0.0.0__b03f5f7f11d50a3a'Microsoft.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_64'System.Data'v4.0_4.0.0.0__b77a5c561934e089'System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'System.Xml'v4.0_4.0.0.0__b77a5c561934e089'System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x3344 has exited with code 0 (0x0).
The thread 0x369c has exited with code 0 (0x0).
The thread 0x4498 has exited with code 0 (0x0).
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'c:'users'chris james'documents'visual studio 2015'Projects'ConsoleApplication3'ConsoleApplication3'bin'Debug'ConsoleApplication3.exe'. Symbols loaded.
'ConsoleApplication3.vshost.exe' (CLR v4.0.30319: ConsoleApplication3.vshost.exe): Loaded 'C:'WINDOWS'Microsoft.Net'assembly'GAC_MSIL'Accessibility'v4.0_4.0.0.0__b03f5f7f11d50a3a'Accessibility.dll'. Symbols loaded.
The thread 0x2b58 has exited with code 0 (0x0).
The thread 0x3994 has exited with code 0 (0x0).
The program '[11144] ConsoleApplication3.vshost.exe' has exited with code 0 (0x0).

我可以使用ctrl + f5看到控制台,这是我通过另一个堆栈溢出问题发现的,但是仅在使用"开始"时它会运行并消失。Visual Studio 终止我的控制台应用程序的速度太快

这是我第一个用 C# 编写的事件驱动编程程序。我想知道我是否应该担心未来的程序,或者我可以每次都绕过它吗?我还通过 Debug>Options>Debugging>Symbols 启用了符号,这将我的错误从找不到文件更改为加载符号。有更好的解决办法吗?我卸载,重新安装,修复,摆脱了可再发行组件,并添加了较旧的可再发行组件,但找不到其他解决方案。任何帮助,不胜感激。

这是代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DelegateTutorial1
{
    public class MediaStorage
    {
        public delegate int PlayMedia();
        public void ReportResult(PlayMedia playerDelegate)
        {
            if (playerDelegate() == 0)
            {
                Console.WriteLine("Media played successfully");
            }
            else
            {
                Console.WriteLine("Media did not play successfully");
            }
        }
    }
    public class AudioPlayer
    {
        private int audioPlayerStatus;
        public int PlayAudioFile()
        {
            Console.WriteLine("Simulating playing an audio file");
            audioPlayerStatus = 0;
            return audioPlayerStatus;
        }
    }
    public class VideoPlayer
    {
        private int videoPlayerStatus;
        public int PlayVideoFile()
        {
            Console.WriteLine("Simulating a failed video file");
            videoPlayerStatus = -1;
            return videoPlayerStatus;
        }
    }
    public class Tester
    {
        public void Run()
        {
            MediaStorage myMediaStorage = new MediaStorage();
            AudioPlayer myAudioPlayer = new AudioPlayer();
            VideoPlayer myVideoPlayer = new VideoPlayer();
            MediaStorage.PlayMedia audioPlayerDelegate = new MediaStorage.PlayMedia(myAudioPlayer.PlayAudioFile);
            MediaStorage.PlayMedia videoPlayerDelegate = new MediaStorage.PlayMedia(myVideoPlayer.PlayVideoFile);
            myMediaStorage.ReportResult(audioPlayerDelegate);
            myMediaStorage.ReportResult(videoPlayerDelegate);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Tester t = new Tester();
            t.Run();
        }
    }
}

Visual Studio Community 2015 Console Application Error on St

这根本不是错误,这是正常的伪装者。

如果启动控制台应用程序,则会显示一个新的控制台窗口,只要进程正在运行,该窗口就会保持打开状态。进程退出后,控制台窗口将关闭。

如果在应用程序末尾插入Console.ReadKey(),则窗口将保持打开状态,直到您按任意键。

所以改变这个...

static void Main(string[] args)
{
    Tester t = new Tester();
    t.Run();
}

。对此...

static void Main(string[] args)
{
    Tester t = new Tester();
    t.Run();
    Console.ReadKey();
}

。控制台窗口将保持打开状态,直到您按任意键。

此外:如果要调试到 .NET 框架中,您"启用"的符号将为您提供帮助。这与控制台应用程序的终止将关闭控制台窗口这一事实无关。