I'm trying to call a WCF Service however when I call the service in VS2019 Debug Mode, it just closes the debugging process and I see this in my debug log:
'NB_ConsoleApp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\slam\source\repos\NB_API\NB_ConsoleApp\bin\Debug\NB_ConsoleApp.exe'. Symbols loaded.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\Users\slam\source\repos\NB_API\NB_ConsoleApp\bin\Debug\NB_API.dll'. Symbols loaded.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'.
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.Desktop.dll'.
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
'NB_ConsoleApp.exe' (CLR v4.0.30319: NB_ConsoleApp.exe): Loaded 'Microsoft.GeneratedCode'.
The program '[25576] NB_ConsoleApp.exe' has exited with code 0 (0x0).
Does anyone know why this code might be happening? This solution consists of two projects: 1 console app and a class library both built in .NET Framework. The console app creates a class object from the class library and then calls functions within those classes. However when I call any function in any of the classes, my debugger is immediately closed and that above info is logged into the debug output. However, I know for a fact that the services work because in a separate solution that consists of just the console app, I can call the services fine and they all return the correct values and I can also use SoapUI to send calls to them directly. I believe this has something to do more with Visual Studio and not actually my code. Does anyone know of what the issue possibly could be?
I fixed the problem. In some of my async functions, instead of using the keyword
awaitduring a function call, I had to append.GetAwaiter().GetResult()to the function instead. I don't know why this solved the problem, but it did...