2013-12-20 4 views
10
var xrr = __arglist(Convert.ToUInt32(1), 
        Convert.ToUInt32(2), 
        Convert.ToUInt32(3)); 

Приведенный выше код заставит компилятор скомпоноваться при сборке. Я бы ожидал, что компилятор остановится со значимым сообщением об ошибке, вместо того, чтобы пытаться скомпилировать код. Это может быть ошибка в компиляторе? Если нет, как я могу решить эту ошибку?Сбой компилятора C# без сообщения об ошибке

+8

Все, что делает аварии компилятор, а не давая ошибка является ошибка компилятора. Однако ваш код недействителен. – SLaks

+2

Я могу подтвердить поведение в VS2010 –

+1

_ «Если нет, как я могу решить эту ошибку?» _ Почему вам вообще нужно использовать '__arglist'? Почему вы не можете использовать ['params'] (http://msdn.microsoft.com/en-us/library/w5zay9db.aspx)? –

ответ

6

Это не ошибка в компиляторе; компилятор дает правильное сообщение об ошибке.
Вместо этого это ошибка в языковой службе редактора Visual Studio, которая приводит к сбою Visual Studio.

Однако ваш код является незаконным в любом случае; __arglist(...) выражения могут использоваться только для вызова функции, которая принимает __arglist.

4

Похоже, вопрос Visual Studio с, не компилятор:

VS2010

System.AccessViolationException

Попытка чтения или записи в защищенную память. Это часто свидетельствует о том, что другая память повреждена.

Источник

Microsoft.VisualStudio.CSharp.Services.Language

Трассировка стека

at Microsoft.RestrictedUsage.CSharp.Compiler.IDE.CompilerIDEInterop.Compilation_CompileMethod(Handle handle, Handle baseNodeOwner, IntPtr baseNodePtr, Handle& treeHandle) 
    at Microsoft.RestrictedUsage.CSharp.Compiler.IDE.IDECompilation.CompileMethod(ParseTreeNode node) 
    at Microsoft.RestrictedUsage.CSharp.Compiler.IDE.IDECompilation.CompileMethod(MethodBaseNode method) 
    at Microsoft.RestrictedUsage.CSharp.Semantics.SemanticParseTreeVisitor.<>c__DisplayClassc.<DispatchMethodBody>b__a() 
    at Microsoft.RestrictedUsage.CSharp.Extensions.ExpressionTreeFinder.get_ExpressionTree() 
    at Microsoft.RestrictedUsage.CSharp.Extensions.CompilationExtensions.FindExpressionTree(Compilation compilation, SourceFile sourceFile, ParseTreeNode leafNode) 
    at Microsoft.VisualStudio.Labs.MemberContainsProvider.MemberContainsItemsSource.GetUniqueLocals(CSharpMemberReference member, ParseTreeNode node, SourceLocation loc, Dictionary`2 dictionary) 
    at Microsoft.VisualStudio.Labs.MemberContainsProvider.MemberContainsItemsSource.GetUniqueLocals(Dictionary`2 locals) 
    at Microsoft.VisualStudio.Labs.MemberContainsProvider.MemberContainsItemsSource.GetMemberChildren() 
    at Microsoft.VisualStudio.Labs.MemberContainsProvider.MemberContainsItemsSource.InitializeItemCollection() 
    at Microsoft.VisualStudio.Labs.ItemsSource`2.InitializeItems() 
    at Microsoft.VisualStudio.Labs.ItemsSource`2.get_Items() 
    at Microsoft.VisualStudio.Labs.AggregateItemsSource.InitializeItemCollection() 
    at Microsoft.VisualStudio.Labs.ItemsSource`2.InitializeItems() 
    at Microsoft.VisualStudio.Labs.ItemsSource`2.get_Items() 
    at Microsoft.VisualStudio.Labs.BrowserNavigationEntry.GetTree(String relationship, Func`2 treeActivator) 
    at Microsoft.VisualStudio.Labs.Browser.OnSelectedRelationshipChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) 
    at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
    at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
    at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) 
    at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) 
    at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) 
    at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) 
    at Microsoft.VisualStudio.Labs.Browser.OnCurrentNavigationEntryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) 
    at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
    at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) 
    at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args) 
    at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType) 
    at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) 
    at System.Windows.DependencyObject.SetValue(DependencyPropertyKey key, Object value) 
    at Microsoft.VisualStudio.Labs.Browser.NavigateTo(Object root, IRelationship relationship) 
    at Microsoft.VisualStudio.Labs.Browser.NavigateTo(Object root) 
    at Microsoft.VisualStudio.Labs.TextViewCreationListener.TextViewSinkManager.TextViewSink.RenderSelectionPopup(Object item, PopupType popupType) 
    at Microsoft.VisualStudio.Labs.TextViewCreationListener.TextViewSinkManager.TextViewSink.PotentiallyShowCSharpPopup(CSharpTextSelection activeSelection, PopupType popupType) 
    at Microsoft.VisualStudio.Labs.TextViewCreationListener.TextViewSinkManager.TextViewSink.textView_MouseHover(Object sender, MouseHoverEventArgs e) 
    at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents() 
    at Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.OnHoverTimer(Object sender, EventArgs e) 
    at System.Windows.Threading.DispatcherTimer.FireTick(Object unused) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 
    at System.Threading.ExecutionContext.runTryCode(Object userData) 
    at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Windows.Threading.DispatcherOperation.Invoke() 
    at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
+3

Я ЛЮБЛЮ сообщения об исключениях для Microsoft: «Это часто свидетельствует о том, что другая память повреждена» – giammin

Смежные вопросы