Hi, I'm writing a TF bridge based provider and fai...
# contribute
w
Hi, I'm writing a TF bridge based provider and fail to build the donet sdk.
Copy code
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 398.46 ms for /home/secustor/repos/pulumi-exoscale/sdk/dotnet/Pulumi.Exoscale.csproj.
Config/Config.cs(49,31): error CS0542: 'Config': member names cannot be the same as their enclosing type [/home/secustor/repos/pulumi-exoscale/sdk/dotnet/Pulumi.Exoscale.csproj]

Build FAILED.

Config/Config.cs(49,31): error CS0542: 'Config': member names cannot be the same as their enclosing type [/home/secustor/repos/pulumi-exoscale/sdk/dotnet/Pulumi.Exoscale.csproj]
    0 Warning(s)
    1 Error(s)
I know that this error can come from resource names, but I do not have any resource which is called
Config
. I guess it is referencing the attribute of
ProviderInfo
with the same name? https://github.com/secustor/pulumi-exoscale/blob/implement_baseline/provider/resources.go#L76 My repo is based on https://github.com/pulumi/pulumi-tf-provider-boilerplate Thanks for your help in advance!
b
Hi @wooden-animal-34285 My apologies for the slow response here - It seems like the link to your branch is incorrect at this moment - is this still an issue for you?
w
No, problem. Yes, I'm still stuck with this issue. The branch has been merged in the meantime. This is the link to the main branch: https://github.com/secustor/pulumi-exoscale/blob/main/provider/resources.go#L76
s
@wooden-animal-34285 This is a fairly common issue we deal with. Here's the solution from an internal playbook (which we probably should make public at some point once it's a little more polished):
Copy code
## "Member names cannot be the same as their enclosing type"

```text
error CS0542: 'ApiKey': member names cannot be the same as their enclosing type [/Users/guin/go/src/github.com/pulumi/pulumi-artifactory/sdk/dotnet/Pulumi.Artifactory.csproj]
Solution: C# does not allow class/struct member names to the same as their enclosing type, e.g. a class named
Foo
cannot also have a member
Foo
. In this case, add an override to
resources.go
like:
Copy code
go
"aws_appsync_domain_name": {
	Tok: awsResource(appsyncMod, "DomainName"),
	Fields: map[string]*tfbridge.SchemaInfo{
		"domain_name": {
			CSharpName: "Name",
		},
	},
},
```
We usually end up choosing a generic name like "Info" if a shortened name does not make sense.
w
Thanks for your help! I have managed to get past this error. But I have ran in another error
error CS1061: 'Config' does not contain a definition for 'GetDouble' and no accessible extension method 'GetDouble' accepting a first argument of type 'Config' could be found
It seems like Pulumi does not generate a Getter function for it. I can skip this by overwriting the type, but I'm not sure if this will prevent the usage down the line.
Copy code
Config: map[string]*tfbridge.SchemaInfo{
			"config": {
				CSharpName: "CloudstackConfig",
			},
			"timeout": {
				Type: "string",
			},
		},
Is this a known issue? Thanks!
s
It's not a known issue to me, but I'm new-ish to Pulumi so my answer isn't exhaustive. Can you post the code for the entire resource mapping? Having that context will help me figure out what might be up here.
w