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

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - 学途

重复安装Lync导致发布拓扑失败 Lync激活用户遇到ConstraintViolationNoLeadingOrTrailingWhitespace错误 JS认证Exchange ExcelService数据来自SharepointList 配置MOSS爬网时错误:访问被拒绝。请验证默认内容访问账户是否有权限 PDA开发个人总结 【转】提高InfoPath表单填写速度的小技巧 sharepoint2010安装问题记录 转-SharePoint相关笔记 纠结的TreeView动态加载节点 - 学途 - 博客园 Microsoft CRM 安装问题汇总 SharePoint安全性验证无效 Treeview.nodes.remove不起作用问题 moss里用Response生成Excel以后页面按钮失效问题 增加内容查询部件的显示字段 备份还原站点笔记 sharepoint中flash展示图片库 AJAX12030和500问题 自定制SharePoint WebServices取附件
feature激活时提示“未将对象引用到实例化”
学途 · 2011-10-26 · via 博客园 - 学途

新写了个定时器作业,用脚步部署,激活时提示未将对象引用到实例化。

调试模式跟踪了一下代码,发现 SPSite site = properties.Feature.Parent as SPSite; 中properties.Feature.Parent能得到值,但是site总是得到null,百思不得其解。

然后尝试激活以前写的正常部署过多定时器作业,报错依旧,怀疑自己的环境出来问题,最后无果。

突然在网上看到别人写的一段代码,于是想到properties.Feature.Parent只是个object,不一定是site,也可能是web,于是改进代码如下:

            SPSite site;
            if (properties.Feature.Parent is SPWeb)
            { site = ((SPWeb)properties.Feature.Parent).Site; }
            else
            { site = (SPSite)properties.Feature.Parent; }

果然一切正常~