我正在使用Resharper 6和ASP.NET Web方法,并在我的Javascript文件中发出令人恼火的警告:
"Use of implicitly declared global variable 'X'"
Run Code Online (Sandbox Code Playgroud)
原因是Web方法是在Javascript中创建的:
new X.example().webMethod(arg1, arg2, successCallback, failureCallback);
Run Code Online (Sandbox Code Playgroud)
并且X ...是隐式定义的.我想知道是否有明确定义的解决方案?它是在一些自动生成的JS文件中定义的,由ASP.NET Web方法框架创建.
我的问题是:我如何摆脱这种情况的错误,而不是在合法的错误情况下摆脱它?
谢谢!
我正在VS2010中编写一些encodeUI测试来测试Web应用程序.我希望能够在解决方案中为浏览器中的整个测试打开一次浏览器,然后在测试完成后再次关闭它.
我已经尝试AssemblyInitialize
了一个方法的属性,我BrowserWindow.Launch
在那里,但是当我运行它时它给了我以下异常:
程序集初始化方法OrdersGridTesting.SuiteSetup.Login引发异常.Microsoft.VisualStudio.TestTools.UITest.Extension.TechnologyNotSupportedException:Microsoft.VisualStudio.TestTools.UITest.Extension.TechnologyNotSupportedException:当前不支持浏览器..中止测试执行.
当我把它放入a时TestMethod
,同样的代码工作正常,这让我相信这是不可能的.有人可以提出另一种方法吗?如果可能的话,我想要一个不涉及向项目中的每个测试类添加相同代码的方法.
谢谢!
这里有一些奇怪的行为.我有一堆代码,图片,然后是一些奇怪的行为的描述,然后是我的问题.
档
我有一个文件random_start_bonus_cards_notification.xml
,看起来像:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/firstCard" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/secondCard" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ifNotCoal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="("
android:paddingTop="15dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/if_not_coal"
android:paddingTop="15dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/thirdCard" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=")"
android:paddingTop="15dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
还有一个档案 random_start_bonus_cards.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"></RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是一个故意空白的布局,因为我们会陷入奇怪的境地.事实证明这个文件必须在这里,但它包含什么并不重要.
Annnnd my styles.xml
:
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
</style>
<style name="NotificationTitle">
<item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
<item name="android:textStyle">bold</item>
</style> …
Run Code Online (Sandbox Code Playgroud) 我有这个错误信息,我不喜欢.
Bad line breaking before '?'.
Run Code Online (Sandbox Code Playgroud)
我觉得像
var s = (a === b)
? 'one'
: 'two';
Run Code Online (Sandbox Code Playgroud)
看起来更好.克罗克福德说:
分号插入可以屏蔽复制/粘贴错误.如果你总是在运算符之后断行,那么JSLint可以更好地找到这些错误.
有人能给我一两个例子,说明他所指的那种复制/粘贴错误吗?
更新:
var s = (a === b)
? 'one'
: 'two';
Run Code Online (Sandbox Code Playgroud)
看起来比
var s;
if(a === b) {
s = 'one';
} else {
s = 'two';
}
Run Code Online (Sandbox Code Playgroud)