惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

阮一峰的网络日志
阮一峰的网络日志
博客园_首页
H
Help Net Security
博客园 - Franky
V
Visual Studio Blog
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
J
Java Code Geeks
L
LangChain Blog
腾讯CDC
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
C
Check Point Blog
博客园 - 聂微东
罗磊的独立博客
量子位
M
MIT News - Artificial intelligence
F
Fortinet All Blogs

博客园 - IT 笔记

Subversion Revert File will not be shown in Modification Surprise vb.net WinForm don't require instance to access the instance value Add Image in MS Report RDLC by using Embedded Image 王爽汇编 Lab 13 Question 1, 用两个程序实现 Spring.NET Installation and setup the first program 王爽汇编语言 实验11 王爽汇编语言 检测点11.2 王爽 汇编语言程序课程设计1 王爽 汇编语言程序设计实验10,题三,数值转换。(Assembly experiment Convert HEX to Decimal and Show on screen ) 王爽 汇编语言程序设计 实验9 (Assembly Language Study) 王爽 汇编语言程序设计 检测点9.1 第2题 The NTVDM CPU has encountered an illegal instruction. CS:0006 IP:130a .... select files by multiple extension name Access Denied when running Spring.IocQuickStart.MovieFinder using vb.net read unix style text file How to install autotrace in fontforge My first postscript program .net 2 config A generic winform skeleton support interactive UI during large job process
Properties.Settings show error 'System.Windows.Forms....
IT 笔记 · 2013-08-30 · via 博客园 - IT 笔记

Today my code suddenly give this error if when I try to access setting in my program.

Some people said I need to put my namespace before Properties.Settings

so it would be <namespace>.Properties.Settings.

I tried to do that but my name space does not contain "Properties". So I checked the generated code under Properties-->Settings.Settings-->Settings.Designer.cs, I can see the setting class do use namespace "<namespace>.Properties", like below

namespace Shopping.Properties {
    
    
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

I finally foind the root cause, It have been caused by a class it is using same name of the namespace, in my job, a class name is "Shopping" and its namespace name is also "Shopping". So it is sort of collision to Framework. 

After I renamed Shopping class to something else, the issue is fixed.

Following article from Eric Lippert’s Blog should be helpful. 

Do not name a class the same as its namespace

http://blogs.msdn.com/b/ericlippert/archive/2010/03/09/do-not-name-a-class-the-same-as-its-namespace-part-one.aspx