You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This piece of code is from VB's My-namespace implementation of a Windows Forms project. (for the binary sample see #2033)
[DebuggerHidden]privatestaticTCreate__Instance__<T>(TInstance)whereT:Form,new(){if(Instance?.IsDisposed??true){if(m_FormBeingCreated!=null){if(m_FormBeingCreated.ContainsKey(typeof(T))){thrownewInvalidOperationException(Utils.GetResourceString("WinForms_RecursiveFormCreate"));}}else{m_FormBeingCreated=newHashtable();}m_FormBeingCreated.Add(typeof(T),null);TargetInvocationExceptionex2;// <------- ex2 is probably missing the init flagtry{returnnewT();}catch(TargetInvocationExceptionex)when(((Func<bool>)delegate{// Could not convert BlockContainer to single expressionProjectData.SetProjectError(ex);ex2=ex;returnex2.InnerException!=null;}).Invoke()){stringresourceString=Utils.GetResourceString("WinForms_SeeInnerException",ex2.InnerException.Message);thrownewInvalidOperationException(resourceString,ex2.InnerException);}finally{m_FormBeingCreated.Remove(typeof(T));}}returnInstance;}
The text was updated successfully, but these errors were encountered:
This doesn't look like On Error Resume Next.
Maybe this is just a regular VB exception filter?
The issue is that "// Could not convert BlockContainer to single expression" -- the ex2 = ex; assignment definitely happens in the exception filter, but due to our immediately-invoked-lambda hack, the C# compiler isn't clever enough to notice that ex2 is initialized.
Maybe ExpressionBuilder.VisitBlockContainer() needs to re-enable the init flag for any variables assigned within the block?
This piece of code is from VB's My-namespace implementation of a Windows Forms project. (for the binary sample see #2033)
The text was updated successfully, but these errors were encountered: