vhson / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Namespace collision with System.Action between SDK (Newtonsoft.Json.dll) and mscorlib #589

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add the Client.dll (or it might be ContentForShopping.dll, I'm using those 
two in my project) to your .NET project
2. If you are using System.Action anywhere, VS reports a namespace collision 
(Exception: 'Action' is ambiguous in namespace 'System').
3. Checking with the Object Browser, Client.dll (or ContentForShopping.dll) 
creates a reference in the project for Newtonsoft.Json.dll, which has it's on 
System namespace with a set of Action delegate Subs inside it.
4. The System.Action I'm trying to use is apparently in conflict with the 
Newtonsoft.Json.dll System.Action.,

What is the expected output? What do you see instead?

No collision ... I should be able to use System.Action without a namespace 
conflict.

What version of the product are you using? On what operating system?

2.0.1

Please provide any additional information below.

Original issue reported on code.google.com by lglath...@gmail.com on 6 May 2012 at 8:26

GoogleCodeExporter commented 9 years ago
I see it in the Core Client.csproj file. I could try to roll my own without it 
but I'm afraid its used somewhere and I'll break something.

<ItemGroup>
    <Reference Include="Newtonsoft.Json">
      <HintPath>..\..\third_party\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System">
      <Name>System</Name>
    </Reference>
    <Reference Include="System.configuration" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml">
      <Name>System.XML</Name>
    </Reference>
  </ItemGroup>

Original comment by lglath...@gmail.com on 6 May 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Looks like the dependency should be removed -- just a guess. Please fix ASAP! 
Thanks ---

Original comment by lglath...@gmail.com on 6 May 2012 at 9:02

GoogleCodeExporter commented 9 years ago
Only seems to be a problem if the call to System.Action (or 
Global.System.Action) is i the Global.asax file. Elsewhere, there is no 
namespace conflict.

Original comment by lglath...@gmail.com on 6 May 2012 at 9:35

GoogleCodeExporter commented 9 years ago
Workaround:

1. Move the call to System.Action into a sub within some public class in the app
2. Call the sub in the Global.asax file

This works, but please fix this conflict in namespaces where it occurs in 
Global.asax. Even using Global.System.Action will not avoid the namespace 
conflict.

Original comment by lglath...@gmail.com on 6 May 2012 at 10:13

GoogleCodeExporter commented 9 years ago
Got word back ... looks like Newtonsoft.Json.dll is critial to the functioning. 
Looks like System.Action namespace within Newtonsoft.Json.dll is normal. Since 
the namespace conflict only occurs in the Global.asax file, use the workaround 
I state in Comment 4 if you are trying to call System.Action (or System.Func 
for that matter) in Global.asax.

Original comment by lglath...@gmail.com on 7 May 2012 at 6:40

GoogleCodeExporter commented 9 years ago
Glad to hear that you found a workaround. We don't manage the 
Newtonsoft.Json.dll and we can't make changes there to address this issue.
I'm marking this as working as intended, thanks for the detailed report.

Original comment by ccherub...@google.com on 7 May 2012 at 6:51