Error in the start of WPF Application

Good afternoon:

I have an application in Microfocus Cobol - WPF that was working until a few hours ago. In the meantime, I've been updating some NuGet packages and, from that point on, when the application starts, it immediately gives an error that is as follows: "

System.ArgumentException
HResult=0x80070057
Message=
An item with the same key has already been added.

Source=mscorlib
StackTrace:
em System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
em System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
em MS.Internal.Resources.ContentFileHelper.GetContentFiles(Assembly asm)
em MS.Internal.Resources.ContentFileHelper.IsContentFile(String partName)
em MS.Internal.AppModel.ResourceContainer.GetResourceManagerWrapper(Uri uri, String& partName, Boolean& isContentFile) em MS.Internal.AppModel\ResourceContainer.cs:linha 138
em MS.Internal.AppModel.ResourceContainer.GetPartCore(Uri uri) em MS.Internal.AppModel\ResourceContainer.cs:linha 68
em System.IO.Packaging.Package.GetPartHelper(Uri partUri)
em System.IO.Packaging.Package.GetPart(Uri partUri)
em System.Windows.Application.GetResourceOrContentPart(Uri uri) em System.Windows\Application.cs:linha 1659
em System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties) em System.Windows\Application.cs:linha 992
em System.Windows.Application.DoStartup() em System.Windows\Application.cs:linha 1453
em System.Windows.Application.<.ctor>b__1_0(Object unused) em System.Windows\Application.cs:linha 707
em System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
em System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
em System.Windows.Threading.DispatcherOperation.InvokeImpl()
em MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
em MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
em System.Windows.Threading.DispatcherOperation.Invoke()
em System.Windows.Threading.Dispatcher.ProcessQueue()
em System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
em MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
em MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
em System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
em System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
em System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
em MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
em MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
em System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
em System.Windows.Application.RunDispatcher(Object ignore) em System.Windows\Application.cs:linha 1951
em System.Windows.Application.RunInternal(Window window) em System.Windows\Application.cs:linha 1551
em WPFApplication1.App.Main() em C:\Users\AlbertoFerraz\source\repos\WPFApplication1\WPFApplication1\obj\Debug\App.g.cbl:linha 24

Can anyone help me with this situation?

Best regards
Alberto Ferraz
  • 0  

    I have never seen this exact error before but the error "An item with the same key has already been added" normally means that there is a duplicate property name, etc defined somewhere. If this was working fine and, you did not change anything in your WPF xaml or COBOL code, but you updated some NuGet packages then it is most likely one of those packages or added project references that is causing the error.

    Is it possible to undo the NuGet changes you made one at a time to see if and when it starts working again?

    Chris Glazier
    Rocket Software - Principal Technical Support Specialist
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0 in reply to   

    Hi Chris,

    I didn't change anything in the application, especially in the initial program that just calls up a screen with the user and password.
    I also tried to downgrade but in the meantime another problem appeared that I reported to Microfocus support and did not post on the forum.

    This problem prevents me from achieving an error-free compilation and so I cannot see if the initial error disappears.



    The new problem it's that: I can't program beyond column 72.

    I don't know what happened but now it's like this. The configuration of the source format is VARIABLE.

    I already have a response from support for this situation and they will do a Webex to check.
    
    When this problem is resolved and I am able to compile, I will test again to see if the initial error continues.

    Then I will give feedback.

    Best regards
    Alberto Ferraz
  • 0   in reply to 

    It sounds like your project has become corrupt. You might try to place the sourceformat"variable" directive directly at the top of the source program in which you are seeing the error.

    $SET SOURCEFORMAT"VARIABLE"

    Chris Glazier
    Rocket Software - Principal Technical Support Specialist
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0   in reply to   

    What version of Visual Studio and Visual COBOL version are you using?

    Chris Glazier
    Rocket Software - Principal Technical Support Specialist
    If you found this post useful, give it a “Like” or click on "Verify Answer" under the "More" button

  • 0 in reply to   

    Hi Chris,

    All the sources I open are in the same conditions (part in column 72).
    I received support from Raquel Campuzano who was checking and is also studying the case of column 72.

    She suggested that I disable "Backgound Syntax Checking" and now the screen no longer appears
    broken and allows writing beyond column 72.

    It continues to give the compilation error with the information that the program is too large and therefore
    I am waiting for her response to what she asked me to do to move the process forward further.
    I am unable to test the situation that I reported with the initial error.

    Best regards

    Alberto Ferraz

  • 0 in reply to   

    VS 2012 versión 17.10.0

    Visual Cobol 8.0 - patch update 17