Guid.Parse throw exception about invalid format, but Guid.TryParse returns true

Volodymyr Shelest 0 Reputation points


I'm working with gRPC technology and now have a weird problem with Guid.Parse method.

First of all, you can see the source code of my project here. The problem is in WebAPI service, Database Info Service responses. TableService.GetByDatabaseAsync is what I've tested and the end stack trace is in AttributeMapper when the program parses attribute id.

I'm trying to fix the problem myself, so lines in StackTrace could be different with the lines from source code in GitLab.

I've attached 2 screenshots:

  • The logs from docker container
  • Code that generate these logs

As you can see Guid.TryParse says that guid is good

But when I parse with Guid.Parse method, I've got such exception.

The Guid is generated with Guid.NewGuid() and has been written to postgres db

User's image

User's image

A set of technologies in the .NET Framework for building web applications and XML web services.
3,585 questions
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.
9,026 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 9,016 Reputation points

    Are you sure it's not one of the other two Guid.Parse calls you're making in that method?