Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPOI.SS.UserModel.RangeType missing namespace #558

Closed
Adin-Sijamija opened this issue May 24, 2021 · 8 comments
Closed

NPOI.SS.UserModel.RangeType missing namespace #558

Adin-Sijamija opened this issue May 24, 2021 · 8 comments
Labels
Milestone

Comments

@Adin-Sijamija
Copy link

Adin-Sijamija commented May 24, 2021

The RangeType class found at namespace NPOI.SS.UserModel inside the IConditionalFormattingThreshold file does not have a namespace associate with it making It a global namespace, thus blocking any other class that shares the same name with it when the nugget package is added to any project producing the following error "Namespace ' contains a definition conflicting with alias RangeType". We have several projects with their own RnageType classes that conflict with the NPOI one.

image

The proposed fix is to add a namespace to the RangeType class and add corresponding using references in files that require said class.

@chucklu
Copy link

chucklu commented May 24, 2021

You might try this https://stackoverflow.com/a/1067573/13338936.

by the way, why you use global namespace in your projects?

@Adin-Sijamija
Copy link
Author

Adin-Sijamija commented May 24, 2021

@chucklu I am not using global namespaces in my project. The global namespace issues comes from NPOI RangeType which is a global namespace and overrides my RangeType, no correlation with NPOI's RangeType class (e.i missing namespace).

As a example XSSFWorkbook has a namespace
image

While RangeType does not
image

Inside https://github.com/nissl-lab/npoi/blob/master/main/SS/UserModel/ConditionalFormattingThreshold.cs the RangeType class should be included into the namespace NPOI.SS.UserModel like the interface is.

@chucklu
Copy link

chucklu commented May 24, 2021

Then you could use the RangeType of npoi as global::RangeType.

@Adin-Sijamija
Copy link
Author

I am not using NPOI's RangeType at all in my code.

@chucklu
Copy link

chucklu commented May 24, 2021

Could you provide a sample repository? I tried to reference npoi in a new Console project, and I added a class RangeType without namespace, which means it's under global namespace.
I just get a warning CS0436,not the error you provided in screenshot.

@chucklu
Copy link

chucklu commented May 24, 2021

According Compiler Error CS0576, are you sure you did not use NPOI's RangeType?

// CS0576.cs  
using SysIO = System.IO;  
public class SysIO  
{  
   public void MyMethod() {}  
}  
  
public class Test  
{  
   public static void Main()  
   {  
      SysIO.Stream s;   // CS0576  
   }  
}  

@IADTIL
Copy link

IADTIL commented May 24, 2021

@chucklu it looks like you have totally misunderstood the problem.

The NPOI code is clearly wrong. It should be an easy fix for anyone involved in developing this code.

@tonyqus tonyqus added the bug label May 25, 2021
@tonyqus
Copy link
Member

tonyqus commented May 25, 2021

This looks to be a mistake. I'll adjust the namespace in the next release.

@tonyqus tonyqus added this to the NPOI 2.5.5 milestone May 25, 2021
@tonyqus tonyqus modified the milestones: NPOI 2.5.5, NPOI 2.5.4 Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants