XAML UWP Windows Store : error CS0266/warning CS1697 when deploying solution - xaml

I've some warning/error when trying to "create App Packages" from a XAML UWP project.
Firstly a warning :
2017\Projects\MyProjectName\MyProjectName\obj\x86\Release\MyPageName.g.cs(1,1,1,194): warning CS1697: Different checksum values given for C:\Users\administrateur\Documents\Visual Studio 2017\Projects\MyProjectName\MyProjectName\MyPageName.xaml
It seem there is a problem with space (the second path is beginning after the last space -before "2017"-). I'm on Win 10.
Ive an cast error too :
1>C:\Users\administrateur\Documents\Visual Studio 2017\Projects\MyProjectName\MyProjectName\obj\x86\Release\MyPageName.g.cs(39,36,39,85): error CS0266: Cannot implicitly convert type 'Windows.UI.Xaml.Controls.Button' to 'MyProjectName.MyButtonReturn'. An explicit conversion exists (are you missing a cast?)
MyButtonReturn is a button coded in a class extending Button, the definition of "MyButtonReturn" is :
public sealed class MyButtonReturn : Button
{...
Any help ?
Thanks

Found the solution, cleaning the solution + building the project on release worked.

Related

Webforms Error shows TWO projects although solution shows ONE project

In a VS-2019 webforms solution I get this error that shows TWO projects although the solution only has ONE project.
Severity: Error
Code Description : BC30456 'prpPageCaption' is not a member of 'MasterPage'.
Project: 7_SessionExpired.aspx, repo_TripManagement
File: C:\Users...\SessionExpired.aspx.vb
Line: 100
Suppression State: Active
It appears that the error shows TWO projects and I did not create a project named 7_SessionExpired.aspx
The vb-page "SessionExpired.aspx and .vb" was copied from a similar project in VS-2017. This is confusing to me and I don't have any way to know what this error is saying.
Here is the LINE=100 from the source VB file:
100| | Master.prpPageCaption = "Session has Expired"
Here is the property in the master-page:
Public Property prpPageCaption() As String
Get
Return Me.lblCaption.Text
End Get
Set(ByVal p_sCaption As String)
Me.lblCaption.Text = p_sCaption
Me.updpanelPageCaption.Update()
End Set
End Property
The vb-page "SessionExpired.aspx and .vb" was copied from a similar project in VS-2017. This is confusing to me and I don't have any way to know what this error is saying. I need your help. Thanks...John
Think the IDE/VS-2019 is confused and I cut ALL of the files for SessionExpired.aspx (.vb) and pasted them in a my-documents-folder.
I then added a webform-page with Master-page (WebForm1.aspx) into the project.
I then added the ASPX objects as UI for the page. I performed a "View Code" option and the / VB-code structure is shown. I only added "Option Explicit ON". Saved both modified files and closed the SOLUTION.
I then re-opened the solution and the code compiled -- even though the full VB-functionality was not coded.
From the 'Solution Explorer' I then renamed the WebForm1.aspx to "SessionExpired" and compiled again -- all ok.
Finally I added the VB-code from the saved-off original SessionExpired.vb code.
All of the errors shown above were cleared and things are working.
IMHO, bringing in an older webform brings with it the old-style of 'designer' and by starting with a VS-2019 webform-page conforms to the VS-2019 designer pattern.
I apologize to those that viewed this question.
Thanks. John.

Property expression of ExpressionStatement expected node to be of a type ["Expression"] but instead got "TSModuleBlock"

I am upgrading the dependencies of my react-native application from 0.53 to 0.59.
But I am facing the below error while trying to build it using ./gradlew assembleRelease.
#babel/template placeholder "$1": Property expression of ExpressionStatement expected node to be of a type ["Expression"] but instead got "TSModuleBlock".
#babel/template placeholder "$1": Property expression of ExpressionStatement expected node to be of a type ["Expression"] but instead got "TSModuleBlock"
at Object.validate (C:\vs-code-upgraded\node_modules#babel\types\lib\definitions\utils.js:132:11)
at validateField (C:\vs-code-upgraded\node_modules#babel\types\lib\validators\validate.js:24:9)
at validate (C:\vs-code-upgraded\node_modules#babel\types\lib\validators\validate.js:17:3)
at builder (C:\vs-code-upgraded\node_modules#babel\types\lib\builders\builder.js:38:27)
at Object.expressionStatement (C:\vs-code-upgraded\node_modules#babel\types\lib\builders\generated\index.js:316:31)
at applyReplacement (C:\vs-code-upgraded\node_modules#babel\template\lib\populate.js:86:27)
I would like to know if there is possiblity to solve this build error.
thank you in advance.
This might probably due to a namespace being exported which only contain interfaces/types (Not actual classes/functions/objects but type declarations).
A quick fix is to add declare to the exported namespace.
export declare namespace SomeNameSpace
instead of
export namespace SomeNameSpace

"inferred type is FragmentManager? but FragmentManager was expected" error after moving to androidX

I just moved my project to androidX. I used android studio refactor->upgrade to androidX. TargetSDK was already 28 and was working fine. So was not expecting many errors. But I was wrong and getting many errors, most of them are about fragmentManager
inferred type is FragmentManager? but FragmentManager was expected
This is when I am calling show method of a custom bottomSheetDialogue in a fragment.
bottomDialog.newInstance(//options here
).show(fragmentManager, bottomDialog.TAG)
The method is annotated as Nullable. Change like this
fragmentManager?.let { manager ->
bottomDialog.newInstance(//options here
).show(manager, bottomDialog.TAG)
}
Make sure you import androidx.fragment.app.FragmentManager instead of a android.app.FragmentManager
I ended up using parentFrgamentManager and it solved the issue. I tried with supportFragmentManager but it wasn't recognised, so used parentFragmentManager. This is the code I used.
bottomDialog.newInstance(//options here
).show(parentFragmentManager, bottomDialog.TAG)

Use a C++/CLI DLL using afxwinforms.h as Reference of another C++/CLI DLL also using afxwinforms.h

In Visual C++ 2010 i added a reference from a C++/CLI DLL (ControlWrapper.dll) to another C++/CLI DLL (CliLibrary.dll).
Both are including afxwinforms.h in the stdafx.h.
When i try to compile i get these errors:
error C2011: 'Microsoft::VisualC::MFC::CWin32Window' : 'class' type redefinition
error C2011: 'Microsoft::VisualC::MFC::CWinFormsEventsHelper' : 'class' type redefinition
If i turn of the Option Reference Assembly Output and add #using "CliLibrary.dll" to the using .cpp File i get the following warnings:
1>ControlWrapper.dll : warning C4944: 'CWin32Window' : cannot import symbol from 'c:\dev\trunk\CliLibrary.dll': as 'Microsoft::VisualC::MFC::CWin32Window' already exists in the current scope
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwinforms.h(83) : see declaration of 'Microsoft::VisualC::MFC::CWin32Window'
1> This diagnostic occurred while importing type 'Microsoft.VisualC.MFC.CWin32Window' from assembly 'CliLibrary, Version=1.0.4843.17337, Culture=neutral, PublicKeyToken=null'.
1>ControlWrapper.dll : warning C4944: 'CWinFormsEventsHelper' : cannot import symbol from 'c:\dev\sfirm\trunk\sfclrlib\debug\sfclrlib.dll': as 'Microsoft::VisualC::MFC::CWinFormsEventsHelper' already exists in the current scope
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\afxwinforms.h(122) : see declaration of 'Microsoft::VisualC::MFC::CWinFormsEventsHelper'
1> This diagnostic occurred while importing type 'Microsoft.VisualC.MFC.CWinFormsEventsHelper' from assembly 'CliLibrary, Version=1.0.4843.17337, Culture=neutral, PublicKeyToken=null'.
How could i solve the error?
Well, this is a painful problem. It certainly explains why you are the first programmer I ever encountered that actually uses this. The problem is caused by this declaration in afxwinforms.h:
public ref class CWin32Window : public System::Windows::Forms::IWin32Window
// etc..
The public keyword is the killer, that adds the class to the manifest of your assembly. So when you reference it in another project that also includes the header then there are two definitions of the class. The mix of both native and managed classes in that header prevents a clean solution.
I think you already found the best solution, using the #include, with #pragma comment(disable:4944) to shutup the compiler. Including the header inside a namespace might be another viable hack, it renames the namespace of CWin32Window, but I'd expect trouble when linking mfcm90.lib. Restructuring your solution and keeping all winforms code inside one project is the only thing I can recommend.
Are you using the types in afxwinforms.h?
If not (like in my case), the solution is to comment the include and add this two lines:
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
or add a reference to that two assemblies in your Project.

ConfigurationManager not declared - Have dll

Quick background: I have a VB.NET application in which I was previously using ConfigurationSettings.AppSettings to read from app.config, and got an error message to change it to System.Configuration.ConfigurationManager.AppSettings (as the first way is now obsolete)
I did so, and I even have a reference to System.Configuration.dll AND the Imports statement at the top, but I am getting a "Name ConfigurationManager not declared" error message. Any suggestions?
CODE:
It's pretty straightforward - I'm just checking if something exists, and if it does, I read from it:
If Not Exists(ConfigurationManager.AppSettings.Get(rep & "Email")) Then
Return False
End If
message = ReadAllText(ConfigurationManager.AppSettings.Get(rep & "Email"))
The project template doesn't have the reference you need. Project + Add Reference, select "System.Configuration".
For more insight, click the "Show All Files" icon at the top of the Solution Explorer window and open the References node.
Another issue that causes this is the reference being the wrong case.
System.configuration was in the .vbproj, instead of System.Configuration.
For me, compiling with the above mistake worked on Windows but not on Linux, but fixing it to the latter made it work on both.
If you are using visual studio 2015 and Visual Basic language. Go to Project + Add Reference > Select Assemblies > Framework. Search for System.configuration. Add the DLL file. After it. On your form, add this in the first line without quotations "Imports System.Configuration" go to your connection string declaration then put this value without quotation "ConfigurationManager.ConnectionStrings("'string configuration name'").ConnectionString" like this.
Public constr As String = ConfigurationManager.ConnectionStrings("string configuration name").ConnectionString
This one works for me. Just now. Hope this one helps others. ^_^