-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception after "Convert to C#" in unsaved window #1023
Comments
Looks like an odd error. Since the code converter isn't shown in the stack trace I'll need a bit more info. Thanks! |
Thanks I've now actually managed to reproduce this issue. Workaround: Save all changes before running conversion I've spent a bit of time looking at making a fix to automatically do this but haven't succeeded yet by running the Dte.SaveAll command For my own reference, the full stack trace is Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject<System.__Canon>.RunOnMainThreadHr.AnonymousMethod__21_0(System.Func<int> innerFunc) Unknown
> ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.VisualStudioInteraction.EnsureBuiltAsync(System.Collections.Generic.IReadOnlyCollection<EnvDTE.Project> projects, System.Func<string, System.Threading.Tasks.Task> writeMessageAsync) Line 197 C#
[Resuming Async Method]
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Unknown
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Unknown
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Unknown
mscorlib.dll!System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.GetActionLogDelegate.AnonymousMethod__0() Unknown
Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTaskFactory.SingleExecuteProtector.TryExecute() Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj) Unknown
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Unknown
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Async Call Stack]
[Async] ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.CodeConversion.EnsureBuiltAsync(System.Collections.Generic.IReadOnlyCollection<EnvDTE.Project> readOnlyCollection) Line 115 C#
[Async] ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.CodeConversion.ConvertDocumentAsync<ICSharpCode.CodeConverter.CSharp.VBToCSConversion>(string documentFilePath, Microsoft.VisualStudio.Text.Span selected, System.Threading.CancellationToken cancellationToken) Line 90 C#
[Async] ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.ConvertVBToCSCommand.ConvertDocumentAsync(string documentPath, Microsoft.VisualStudio.Text.Span selected, System.Threading.CancellationToken cancellationToken) Line 183 C#
[Async] ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.ConvertVBToCSCommand.CodeEditorMenuItemCallbackAsync(System.Threading.CancellationToken cancellationToken) Line 156 C#
[Async] ICSharpCode.CodeConverter.VsExtension.dll!ICSharpCode.CodeConverter.VsExtension.OleMenuCommandWithBlockingStatus..ctor.__ExecuteAsync|1() Line 28 C#
[Async] Microsoft.VisualStudio.Threading.dll!Microsoft.VisualStudio.Threading.JoinableTask.SetWrappedTask.AnonymousMethod__91_0(System.Threading.Tasks.Task t, object s) Unknown |
Thank you for your research and infos so far. From your feedback I could identify the Problem on my site. The error occurs when the chosen file has not been saved before starting the converter. So I got the solution. |
Hello,
When I want to translate any VB.NET Code to C# in Visual Studio 2022 I get the following error message:
Regards John
The text was updated successfully, but these errors were encountered: