You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Namespace and .dll name collisions (CppCodeGen) #122
2> repro.cpp
2>c:\dev\git\corert\src\iltonative\repronative\repro.cpp(113): error C3083: 'WebApplication106': the symbol to the left of a '::' must be a type
2>c:\users\davifowl\documents\visual studio 2015\projects\webapplication106\src\webapplication106\startup.cs(9): error C3083: 'WebApplication106': the symbol to the left of a '::' must be a type
2>c:\users\davifowl\documents\visual studio 2015\projects\webapplication106\src\webapplication106\startup.cs(17): error C3083: 'WebApplication106': the symbol to the left of a '::' must be a type
2>c:\users\davifowl\documents\visual studio 2015\projects\webapplication106\src\webapplication106\startup.cs(19): error C3083: 'WebApplication106': the symbol to the left of a '::' must be a type
2> main.cpp
2> Generating Code...
The problem is that the .dll name and namespace name are the same. The name mangling is not robust enough to deal with it yet - general problem tracked by #32. You can work around it by renaming namespace WebApplication106 to something else.
I'm in need to get this fixed since it is quite frequent in our code to have the assembly name using the same namespace name. I'm currently testing a solution where the name mangling would prepend an _ when there is such a conflict. Is this something you have in mind? Should we always prepend an _ for assembly name, the likelihood you would have to add an extra _ would be quite reduced.
Activity
[-]Delegates don't work (IL2CPP)[/-][+]Delegates don't work (CppCodeGen)[/+]jkotas commentedon Oct 25, 2015
What is the compilation error that you see in the generated Cpp? The small repro works fine for me.
davidfowl commentedon Oct 25, 2015
davidfowl commentedon Oct 25, 2015
I see the problem. It's creating a bogus namespace:
Broken
Fixed
davidfowl commentedon Oct 25, 2015
Bah, that's not the problem. Still getting errors.
davidfowl commentedon Oct 25, 2015
So it seems it's happening all over the file. I end up with
WebApplication106:: WebApplication106::Somethingand some things don't like that.davidfowl commentedon Oct 25, 2015
Yep that was it. All fixed now. Will see if I can figure out where it goes wrong
jkotas commentedon Oct 25, 2015
The problem is that the .dll name and namespace name are the same. The name mangling is not robust enough to deal with it yet - general problem tracked by #32. You can work around it by renaming namespace WebApplication106 to something else.
[-]Delegates don't work (CppCodeGen)[/-][+]Namespace and .dll name collisions (CppCodeGen)[/+]manu-st commentedon Feb 5, 2016
I'm in need to get this fixed since it is quite frequent in our code to have the assembly name using the same namespace name. I'm currently testing a solution where the name mangling would prepend an _ when there is such a conflict. Is this something you have in mind? Should we always prepend an _ for assembly name, the likelihood you would have to add an extra _ would be quite reduced.
jkotas commentedon Feb 5, 2016
Maybe a better option is to always fully qualify the names in the generated C++ code (with :: prefix).
manu-st commentedon Feb 8, 2016
I've done that locally. Could you remind me where I should add a test to cover this specific scenario?
jkotas commentedon Feb 8, 2016
You can add a new test under tests\src\Simple with the interesting cases of name collisions that you are fixing.
Other than that - just make sure that the few tests (hello world, etc.) that are running as part of the build still work.
MichalStrehovsky commentedon Feb 18, 2016
@manu-silicon @jkotas Can we close this now?
manu-st commentedon Feb 18, 2016
I was not the original reporter but what I fixed seems to be exactly that scenario, so I would say we can close it now.