在我的App()初始化代码中,我包含了一个通用的处理程序
UnhandledException += Application_UnhandledException;
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
Debugger.Break();
}
Run Code Online (Sandbox Code Playgroud)
我有2个屏幕可以正常工作,但是当在两个屏幕之间来回快速导航多次(在7到12之间变化)时,我遇到了这个断点.
{System.Windows.ApplicationUnhandledExceptionEventArgs} base {System.EventArgs}: {System.Windows.ApplicationUnhandledExceptionEventArgs}
ExceptionObject: {System.ArgumentException: Value does not fall within the expected range.}
Handled: false
Run Code Online (Sandbox Code Playgroud)
如果我删除UnhandledException并将调试器设置为未处理的中断,我会得到以下内容:
Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Windows.Markup.XamlParseException: 2028 An error has occurred. [Line: 0 Position: 0] ---> System.ArgumentException: [Arg_ArgumentException]
Arguments: Debugging resource strings are unavailable.
Often the key and arguments provide sufficient information to diagnose the problem.
See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60531.0&File=mscorlib.dll&Key=Arg_ArgumentException
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection …Run Code Online (Sandbox Code Playgroud) 我在XP Pro机器上运行Delphi 2010 Professional.我已经在一个项目上工作了好几天.每次我在我的开发机器上运行程序它都运行正常或者我想.我从IDE中运行该程序,它运行正常.我从输出目录(IDE外部)运行程序,它运行正常.我在我的机器上运行这个程序时没有任何问题.
因此,为了模拟客户体验,我将.exe文件复制到记忆棒上,然后将其复制到完全不同的机器上.当我在不同的机器上运行程序时,我得到一个未处理的win32异常.
这是错误对话框:
+------------------------------------------------------------------------------+
| Visual Studio Just-In-Time Debugger |
+------------------------------------------------------------------------------+
| An unhandled win32 exception occured in ZilchStd.exe [984]. Just-In-Time |
| debugging this exception failed with the following error: No installed |
| debugger has Just-In-Time debugging enabled. In Visual Studio, Just-In-Time |
| debugging can be enabled from the Tools/Options/Debugging/Just-In-Time. |
| |
| Check the documention index for "just-in-tim debugging, errors' from more |
| information. |
+------------------------------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)
我以前从来没有遇到过这种情况.如何解决此错误?
所以我一直在开发关于如何编写计算器的想法,并且我每次都会继续获取未处理的异常但代码不会出现任何错误,并且在多次读取代码后我不确定出现了什么问题.
string inp;
int location;
double num1, num2, ans;
string[] ops = {"+", "-", "*", "/" };
Console.WriteLine("Calculator");
Console.WriteLine("Enter a Calculation.");
inp = Console.ReadLine();
if (inp.Contains(ops[0]))
{
location = inp.IndexOf("+");
num1 = double.Parse(inp.Substring(0, location));
num2 = double.Parse(inp.Substring(location +1));
ans = num1 + num2;
Console.WriteLine("{0}+{2}={3}", num1, num2, ans.ToString("0.###"));
}
else if (inp.Contains(ops[1]))
{
location = inp.IndexOf("-");
num1 = double.Parse(inp.Substring(0, location));
num2 = double.Parse(inp.Substring(location +1));
ans = num1 - num2;
Console.WriteLine("{0}-{2}={3}", num1, num2, ans.ToString("0.###"));
}
else if (inp.Contains(ops[2]))
{
location = inp.IndexOf("*"); …Run Code Online (Sandbox Code Playgroud) 我的preveus问题中的这个主题:如何在Windows事件查看器中删除和创建日志
我创建了wpf app.我用3种方式捕捉未处理的异常:
public partial class App : Application
{
public App()
{
DispatcherUnhandledException += App_DispatcherUnhandledException;
Dispatcher.UnhandledException += Dispatcher_UnhandledException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
private void Dispatcher_UnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
}
}
Run Code Online (Sandbox Code Playgroud)
我正在创建这样的异常:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
throw new Exception("Test exception");
}
}
Run Code Online (Sandbox Code Playgroud)
在执行方法(Dispatcher_UnhandledException,)之后CurrentDomain_UnhandledException,App_DispatcherUnhandledException这个异常仍在抛出.Windows事件查看器正在创建这样的日志
描述:由于未处理的异常,进程终止.异常信息:System.Data.ProviderBase.DbConnectionFactory.TryGetConnection的System.InvalidOperationException(System.Data.Common.DbConnection,System.Threading.Tasks.TaskCompletionSource
1<System.Data.ProviderBase.DbConnectionInternal>, System.Data.Common.DbConnectionOptions, System.Data.ProviderBase.DbConnectionInternal, System.Data.ProviderBase.DbConnectionInternal ByRef) …
在Java程序中,我目前在程序中的某个点获得"Unhandled Exception",我似乎无法确定生成它的位置.
由于程序包含处理发送和接收的无线数据字节的流,因此调试代码也很困难.我似乎无法用调试器模拟它.
我应该采取什么策略来定位异常?
try
{
list = from XElement e in d.Descendants(wix + "File")
where e.Attribute("Name").Value.Contains(temp.Name) &&
e.Parent.Parent.Attribute("Name").Value.Contains(temp.Directory.Name)
select e;
}
catch (NullReferenceException e)
{
MessageBox.Show(e.Message);
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
Run Code Online (Sandbox Code Playgroud)
现在我的问题是为什么这段代码产生运行时错误,说我有一个未处理的NullReferenceException.如果您需要有关该计划的更多信息,请通知我.
编辑:调试器指向linq语句的"where"部分.当我直接从exe文件运行这个程序时,我仍然得到异常.
我有一个相对较大的类,我正在使用它,到目前为止一切正常(注意:我实际上没有编写类,我只是添加了一些功能).但是,在头文件中再声明一个字符串后,现在一切都崩溃了(我得到了内存访问错误).如果我删除该字符串并重建,一切正常.
我实际上并没有使用该字符串做任何事情....只是声明它的行为导致了一些奇怪的内存错误.
我无法详细解释这个问题,因为尝试解释每个功能都是浪费.我应该在这里寻找什么样的东西才能找到问题?什么可能导致这种奇怪的行为?
错误本身是:
Unhandled exception at 0x65fd17fd (msvcp80d.dll) in myFile.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
基本上.h文件中的所有更改都是:
StringType string1;
Run Code Online (Sandbox Code Playgroud)
转换成:
StringType string1;
StringType string2;
Run Code Online (Sandbox Code Playgroud)
StringType是basic_string的扩展
c++ visual-studio-2005 unhandled-exception undefined-behavior write-error
public MainPage()
{
InitializeComponent();
CheckBox c = new CheckBox();
for (int i = 0; i < 2; i++)
{
c.Content = " Value ";
lbox.Items.Add(c);
}
}
Run Code Online (Sandbox Code Playgroud)
lboxUI中是一个空的列表框,上面的代码抛出一个未处理的异常,该异常由代码捕获App.xaml.cs.如果我删除for循环,代码工作正常.这段代码出了什么问题?
我正在尝试用输入文本制作一个香农代码制作者,我有一些麻烦......
所以,有一些简单的狗屎代码
int main()
{
string x="this is very big text.";
int temp;
int N = x.length();
int *mass = new int [N];
Run Code Online (Sandbox Code Playgroud)
然后计算文本中的符号;
然后计算从ASCII表使用的符号;
用符号和符号计数器创造新的2个大众,但它们的尺寸相当小;
删除旧的字母大量 delete mass;
通过计数器排序并计算其累积概率;
double * cumulative = new double (k);
double temp=int_mass[0];
cumulative[0]=0;
for (int i=1; i<k; i++)
{
temp=int_mass[i-1];
cumulative[i]=cumulative[i-1]+temp/N;
}
Run Code Online (Sandbox Code Playgroud)
cout'ing所有3个massives
double a,b,n;
n=N;
for (int i=0; i<k; i++)
{
b=int_mass[i];
b/=n;
cout<<char_mass[i]<<" ";
cout<<b<<" "; //**__**__**
cout<<cumulative[i]<<endl;
}
Run Code Online (Sandbox Code Playgroud)
所以,我有一些麻烦.如果文本很小,那么我会在praogram终止时捕获未处理的异常.如果文字很大,大约100多个符号,我在__**__有例外.
你有什么建议,为什么会这样?
对不起大代码,这是我第一次提交StackOverFlow.
我已经实现了一个智能指针类,当我尝试编译时,它停在一个特定的行上,我得到这个消息:test.exe中0x00418c38处的未处理异常:0xC0000005:访问冲突读取位置0xfffffffc.
我的代码是:
template <class T>
class SmartPointer
{
private:
T* ptr;
int* mone;
public:
SmartPointer() : ptr(0), mone(0) //default constructor
{
int* mone = new int (1);
}
SmartPointer(T* ptr2) : ptr(ptr2), mone(0)
{
int* mone = new int (1);
}
SmartPointer<T>& operator= (const SmartPointer& second) //assignment operator
{
if (this!= &second)
{
if (*mone==1)
{
delete ptr;
delete mone;
}
ptr = second.ptr;
mone = second.mone;
*mone++;
}
return *this;
}
~SmartPointer() // Destructor
{
*mone--;
if (*mone==0) …Run Code Online (Sandbox Code Playgroud) 该代码具有头文件、实现文件和主文件。它应该增加字符串中所有字符的 ASCII 值,然后返回与该 ASCII 值关联的字符值。
有问题的代码如下:
for(int i = 0; i < sizeof(letters); i++)
{
if ((int)letters.at(i) >= (int)'a' && (int)letters.at(i) <= (int)'z')
{
letters.at(i) = (((letters.at(i) - 'a') + 1) % 26 + 'a');
}
else if ((int)letters.at(i) >= (int)'A' && (int)letters.at(i) <= (int)'Z')
{
letters.at(i) = (((letters.at(i) - 'a') + 1) % 26 + 'A');
}
}
Run Code Online (Sandbox Code Playgroud)
HomeworkNine.exe 中 0x750A3DB2 处的未处理异常:Microsoft C++ 异常:内存位置 0x00EFF7E8 处的 std::out_of_range。发生了
我看不出越界在哪里,因为我认为模数会解决这个问题。
我已按照(http://www.c-sharpcorner.com/UploadFile/a6fd36/understand-self-host-of-a-web-apiC-Sharp/)和(http://www.c- Sharpcorner.com/uploadfile/a6fd36/understanding-how-to-call-the-web-api-from-a-client-applica/)但似乎仍然出现 System.AggregateException
//Call HttpClient.GetAsync to send a GET request to the appropriate URI
HttpResponseMessage resp = client.GetAsync("api/books").Result;
Run Code Online (Sandbox Code Playgroud)
和
var resp = client.GetAsync(string.Format("api/books/{0}", id)).Result;
Run Code Online (Sandbox Code Playgroud)
和
var resp = client.GetAsync(query).Result;
Run Code Online (Sandbox Code Playgroud)
错误指出: mscorlib.dll 中发生了类型为“System.AggregateException”的未处理异常
异常详细信息 -
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at TestClient.Program.ListAllBooks() in c:\Users\wa\Documents\Visual Studio 2013\Projects\SelfHost\TestClient\Program.cs:line 35
at TestClient.Program.Main(String[] args) in c:\Users\wa\Documents\Visual Studio 2013\Projects\SelfHost\TestClient\Program.cs:line 20
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, …Run Code Online (Sandbox Code Playgroud) 我构建了以下类:
public class FSCServerLocator
{
public string userLocation { get; private set; }
public string FSCServer
{
get
{
switch (userLocation)
{
default:
return @"\\himgwsfs01\QT_Tools\Diagnose\09_SWT_FSCs";
}
}
}
public FSCServerLocator(string location)
{
if (string.IsNullOrWhiteSpace(userLocation))
{
throw new Exception("No location included at initialization");
}
//parameter filtering
userLocation = location;
}
}
}
Run Code Online (Sandbox Code Playgroud)
并像这样调用对象
var fscServerLocator = new FSCServerLocator(@"\\himgwsfs01\QT_Tools\Diagnose\09_SWT_FSCs");
Run Code Online (Sandbox Code Playgroud)
在运行程序时,会抛出一个未处理的异常{"No location included at initialization"}.我只是想看看是否到达了位置,但也许我错过了一些东西,因为我是新的c#
c# ×6
c++ ×4
.net ×2
exception ×2
calculator ×1
crash ×1
delphi ×1
delphi-2010 ×1
java ×1
loops ×1
silverlight ×1
try-catch ×1
wpf ×1
write-error ×1