I am getting an error when trying to open my Winform in design view

Quatic 1 Reputation point
2022-02-02T23:09:13.14+00:00

I am getting the follow error when trying to open my winform in design view in visual studio 2022 (C#)

System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
at System.Configuration.ClientConfigurationHost.get_IsAppConfigHttp()
at System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp()
at System.Configuration.ClientConfigurationSystem..ctor()
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,404 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Quatic 1 Reputation point
    2022-02-11T22:24:57.837+00:00

    So I caught the culprit for this little nasty bug, this was in the designer generated code:

    this.Load += new System.EventHandler(this.listBase_Load);
    and for some reason this listBase_Load was an async function causing the whole thing to crash. Fix was to not make the load event call an async function.

    0 comments No comments