v2.0 Preview 0.6 RELEASED!

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

v2.0 Preview 0.6 RELEASED!

Postby JS-Support @Userware » Sun Oct 06, 2019 1:51 am

Dear CSHTML5 users,

We are excited to inform you that the fifth public Preview release of CSHTML5 2.0 - now powered by Bridge.NET - is available for download!

IMPORTANT: Before updating any of your existing v1.x projects to v2.x, be sure to make a backup copy first. After updating, please be sure to restart VS and rebuild the solution.


Where can I DOWNLOAD it from?

You can download the VSIX installer for v2.0 Preview 0.6 (Alpha49-068) (for VS 2015 or newer, 139MB) from:

http://cshtml5.com/setup/CSHTML5_v2_0_Preview_0_6_Alpha49_068.vsix



How to try it out?

  1. Install the VSIX above (for VS 2015 or newer) (the download link is above)
  2. It will add a new category to the "New Project" dialog named "CSHTML5 v2"
  3. Create a new project using one of those new project templates (see screenshot below)
  4. Build the project
  5. Go to the "bin/Debug/Output/" folder and launch "index.html"

Note: to enable debugging in the Simulator, please be sure to read the Debugging Tips.

Note: you can safely install the versions 2.x side-by-side with the versions 1.x. In other words, you do not need to uninstall the versions 1.x in order to install the versions 2.x.

To update an existing project from CSHTML5 version 1.x to version 2.x:
  1. Please be aware that this action cannot be reverted easily. Therefore, we strongly recommend you to make a BACKUP copy of your project before updating it to v2.x.
  2. Go to the NuGet package manager, and add a reference to the latest version of the NuGet package named "CSHTML5" or "CSHTML5.Migration" (depending on whether you are using the normal edition or the "Silverlight Migration Edition"). Note: if you don't see it in the list of available packages, it's because you must check the option "include prerelease" next to the search field.
Note: If you get an error that says "The 'AssemblyAttributesGenerator' task was not given a value for the required parameter 'OutputRootPath'" or "BeforeXamlProcessor (pass1) failed: System.IO.FileNotFoundException", please close and relaunch Visual Studio, and try again. Alternatively, killing all the running 'msbuild.exe' processes (via the Task Manager) can fix the issue too.



What's new since the Preview 0.5?

New features:
  • The XAML Editor is now available (like in v1.x)
  • The Silverlight Migration Wizard is now available (like in v1.x)
  • Much improved Simulator support
  • Improved performance when running in the browser (to try it out, visit the updated live Showcase)
  • Reduced the file size of the generated ".meta.js" files
  • You can now accelerate the compilation by adding the conditional symbol "DISABLE_JS_OUTPUT" which limits debugging to the Simulator
  • Improved the feedback on errors when calling Interop.ExecuteJavascript() so that the origin of the error is easier to find out
  • Support for the "StringFormat" parameter in XAML Binding declarations
  • Slider control
  • TransformGroup
  • Improved the XML deserialization performance when running in the Simulator
  • Improved the DataGrid so that single-clicking on a cell immediately enters Edit Mode. We also added the option "EnableTwoStepsEditMode" to revert to the previous behavior (which was more similar to the Silverlight DataGrid behavior)
  • Improved the DataGrid so that the TextBox for editing a cell value has the focus and the text is automatically selected (for faster editing)
  • New "View JavaScript Console log..." command in the bottom-left corner of the Simulator
  • The default display size in the Simulator is now "Desktop" rather than "Phone"
  • New "Debugging Tips" link in the Simulator
  • Support for relative URIs when programmatically setting the Source of an <Image> or <MediaElement> control
  • Added an option to omit the XML declaration (ie. the XML header) when serializing using the DataContractSerializer (cf. the "omitXmlDeclaration" parameter in the "SerializeToString" method)
  • Added the property "INTERNAL_DomImageElement" to the <Image> control to access to the DOM <img> HTML element that is generated by the XAML control to render the image
  • Support for the C# properties "XNamespace.Xmlns" and "XNamespace.Xml"
  • Made it so that the "DataContractSerializer" always produces the exact same result (previously, some local prefixes could be randomly generated)
  • Added support for [XmlAttribute] during serialization when using the "XmlSerializer" format (note: you can use the constructor of DataContractSerializer to set the XmlSerializer format if needed)
  • XObject
  • KeyTime.FromTimeSpan
  • Improved the error message in SOAP WCF when the server is not found, and added the "CommunicationException" class
  • Improved performance of the "ItemsControl" when the "ItemsPanel" property is set
  • Added methods to profile performance (CSHTML5.Profiler.Console.Time, Console.TimeEnd, and Console.TimeLog) and added a global setting to log performance when attaching UI controls (in "Application.Current.Host.Settings")
  • New application-wide performance option to avoid loading the controls that are Collapsed (until they become Visible) (the setting is: "Application.Current.Host.Settings.EnableOptimizationWhereCollapsedControlsAreNotLoaded")
  • The "DefaultSoapCredentialsMode" is now "Disabled" rather than "Auto" to avoid displaying many messages in the browser Console. If your application requires WCF authentication or cookies, please be sure to set "Application.Current.Host.Settings.DefaultSoapCredentialsMode" to "Enabled" or "Auto" in your "App.xaml.cs" constructor.
  • Improved "PagedCollectionView"
  • DataGrid.AlternatingRowBackground and RowBackground
  • DataGrid.ColumnHeaderHeight
  • DataGrid.CellStyle and DataGridColumn.CellStyle
  • Calendar.IsTodayHighlighted, Calendar.DisplayDateStart, Calendar.DisplayDateEnd, and Calendar.DisplayDate
  • TextElement.FontWeight support in the HtmlCanvas (special thanks to RankingSw for the contribution on GitHub!)
  • The DatePicker popup now always stays within the screen boundaries (special thanks to ThiagoCalcasFbc for the contribution on GitHub!)
  • Added "Application.Current.Host.Settings.EnableProgressiveRendering" for experimental UI performance improvements

Fixes:
  • Fixed support for the XAML Inspector (in the Simulator)
  • Fixed Try/Catch support around WCF calls and WebClient calls
  • Fixed an issue that prevented TypeScript Definitions from being considered at design-time (for auto-completion, etc.)
  • Fixed an issue that prevented getting the pointer position in pointer events on touchscreen-based Firefox
  • Fixed a compilation error related to WCF
  • Fixed the command "Debug JS code executed by the Simulator so far..." available in the bottom-left corner of the Simulator
  • Fixed an issue where only certain formats of the URI in the "Source" property of merged dictionaries were supported
  • Fixed an issue when Double value was "Infinity" or "-Infinity" in XAML files
  • Fixed an issue with "PropertyChangedEventArgs"
  • Fixed support for ColumnDefinition.MinWidth and RowDefinition.MinHeight (in the <Grid> control)
  • Fixed an issue where a templated PasswordBox would not have the correct background
  • Fixed an issue where the Width, Height, and FontSize of PasswordBox was incorrect
  • Fixed an issue where the property TextBox.Text could return an incorrect value if the template of the TextBox contains elements such as a hint (aka "PlaceholderText")
  • Fixed an issue where if a String contained in a ResX was not found, it would throw an exception rather than just returning the key name
  • Fixed issues with the "Duration" type, improved support for animations automatic duration, and improved the accuracy of "ObjectAnimationUsingKeyFrames" and "DoubleAnimationUsingKeyFrames"
  • Fixed support for [DataMember(Name="name")] when serializing with the DataContractSerializer
  • Fixed default namespace when serializing using the XmlSerializer format
  • Fixed an issue during deserialization with the DataContractSerializer, which happened when a member was marked as "Required" but was "Nil" in the XML
  • Fixed an issue when serializing with the DataContractSerializer, where the [DataContract(Name="someclassname")] attribute on a class was ignored when that class was inside a property of type enumerable
  • Fixed an issue during serialization with the DataContractSerializer, which resulted in the wrong order of the properties if a property was defined both in a base class ("virtual") and in a derived class("override")
  • Fixed an issue with the serialization via the DataContractSerializer where directly serializing an Enum
  • Fixed issue where resource images sometimes could not be found at runtime if they contained uppercase characters
  • Fixed an issue where images whose relative path starts with "/" (or "") are not correctly considered as "relative to the root of the assembly" (they are incorrectly considered as "relative to the XAML where they were used")
  • Fixed an issue where going to a VisualState and immediately back to the previous one still applied the modifications of the VisualState (for example: make a Style for Button and put a different background in the Disabled State, then disable-enable it)
  • Fixed an issue with the way the default value of TypeMetadata is handled
  • UIElements now release the pointer capture when they are detached from the visual tree to avoid locking the app in a state where the pointer events are captured by a removed element
  • Fixed IsChecked not being set when clicking on a RadioButton in the Simulator
  • Fixed an issue with "IsReadOnly" in the DataGrid cells
  • Fixed an issue where "Canvas.Left" and "Canvas.Top" were wrongfully applied to elements that are not in a Canvas
  • Fixed an issue related to inherited IsEnabled and isHitTestVisible when the local value was set to True
  • Fixed an issue were disabled UI elements could still be focused when pressing the tab key (for example, the issue would let the user trigger the Click event on a Disabled Button by putting the focus in it and pressing space or enter)


What are the benefits of the 2.0 version compared to version 1.x?

  • Whole new engine to convert C# to JS: now based on Bridge.NET instead of JSIL
  • Better performance; Much faster load times; Smaller footprint; Minification
  • Source maps (to debug in C# while running in the browser)
  • Support for build servers and VSTS (Azure DevOps) for continuous delivery
  • Support for newer C# versions (up to C# 7.2)
  • Distributed as a NuGet package (and a .VSIX setup for project templates and design-time VS integration)
  • Improved Mscorlib support, and errors are now also reported at Design-Time rather than Compile-Time
  • Easier interop with JS frameworks (Angular, React, Vue...)
  • Lots of bug fixes (support for "Post Build" event, support for the "dynamic" keyword...)



Some regressions compared to v1.2 are expected while we are in this Preview phase.

Please report any issues as separate forum threads, so that we can easily track them and mark them as pending/solved.

We hope that you will enjoy this release and we thank all the people and companies that have helped us to make it possible.

Regards,
The CSHTML5 Team



Attachment - the "New Project" dialog:
New Project v2.png
New Project v2.png (32.81 KiB) Viewed 107468 times


Attachment - how to enable Simulator debugging:
screenshot_vs_debugging_options_to_check.png
screenshot_vs_debugging_options_to_check.png (69.79 KiB) Viewed 107468 times

MichaelHughes
Posts: 41
Joined: Thu Oct 08, 2015 5:33 am

Re: v2.0 Preview 0.6 RELEASED!

Postby MichaelHughes » Mon Oct 07, 2019 11:28 pm

Can you tell me when 1.2.4 is to be released please. I need the resize to work asap.

I can't try switching to version 2 until after a Nov webinar demonstration I'm giving.

Many thanks

krylon
Posts: 6
Joined: Wed Sep 04, 2019 11:04 pm

Re: v2.0 Preview 0.6 RELEASED!

Postby krylon » Tue Oct 08, 2019 11:01 pm

The XAML editor still does not work in Visual Studio 2019 (I was able to reproduce this problem on two machines).

Is this a known problem, and if so, is there any hope of getting this to work soon?

Thank you!

Rourke
Posts: 11
Joined: Mon Jun 06, 2016 7:26 pm

Re: v2.0 Preview 0.6 RELEASED!

Postby Rourke » Wed Oct 09, 2019 4:16 pm

krylon wrote:The XAML editor still does not work in Visual Studio 2019 (I was able to reproduce this problem on two machines).

Is this a known problem, and if so, is there any hope of getting this to work soon?

Thank you!

Curiously in VS2019 I see the Design window working, but the XAML (code) window is blank and can't be accessed. This was the same with Preview 0.5. All working in VS2017

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.6 RELEASED!

Postby Black-Byte » Thu Oct 10, 2019 6:02 am

Hi,

i've testing with the MediaElement. Looks like it doesn't like setting width/height via sourcecode. The params was only set on the surrounding div element. Not at the video element itself, my test videos are allways overflowing the borders. A quick fix is to set the same style to the video element. Works for me, if i use this after i set the source via sourcecode.

Code: Select all

   object video = CSHTML5.Interop.GetDiv(varMediaElement);
   CSHTML5.Interop.ExecuteJavaScript("$0.firstChild.setAttribute('style', $0.getAttribute('style'))", video);


Greets.

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.6 RELEASED!

Postby Black-Byte » Tue Nov 19, 2019 1:13 am

Hi,

i'm testing again with latest Release(2.0.0-alpha50-070). It works mostly. But i stumble upon some longe time consumption.
My software builds some complex canvas elements like 4 main elements with many childs. And i want to switch fast between them.
So i decided to build at startup and set all unwanted at the moment with Visibility = Visibility.Collapsed . That set in the correspondending <div> element in html a style with "diplay: none". Thats ok. but when im changing the Visibility with the code. It takes 400ms - 1500ms to make it visible again. When im changing direct the div element via chrome devtools it switches instantly.
How could i speedup this process via code ?

Greets
Black-Byte

Edit: Looks like the problem has nothing to do with the visibility. I've made a refresh routine that takes the entire page and remove and repaste the canvas. To recalcualculate all center elements etc. I'm trying to fix that.

Edit2: Most of the time consumtion comes from my workaround cause HorizontalAlignment doesn't work! I'm testing with label in a canvas. if tried with set at control, parent. via css style. nothing works .. looks like cshtml doesn't support this :(

Edit:3 I found a solution after browsing the cshtml sources. I'm tweaking the Dom. After the Loaded event i use this code to change the css. Beware CSharpXamlForHtml5.DomManagement.GetDomElementFromControl is depricated i didn't found a replacement yet.

Code: Select all

         dynamic Loc_DomElement = CSharpXamlForHtml5.DomManagement.GetDomElementFromControl(CSHTML5CONTROL);
         if (Loc_DomElement != null)
         {
            dynamic Loc_DomChild = CSHTML5.Internal.INTERNAL_HtmlDomManager.GetFirstChildDomElement(Loc_DomElement);
            CSHTML5.Internal.INTERNAL_HtmlDomManager.SetDomElementStyleProperty(Loc_DomChild, new List<string>() {"width", "height"}, "auto");
            CSHTML5.Internal.INTERNAL_HtmlDomManager.SetDomElementStyleProperty(Loc_DomElement, new List<string>() { "display" }, "flex");
            CSHTML5.Internal.INTERNAL_HtmlDomManager.SetDomElementStyleProperty(Loc_DomElement, new List<string>() { "justify-content" }, "center");
            CSHTML5.Internal.INTERNAL_HtmlDomManager.SetDomElementStyleProperty(Loc_DomElement, new List<string>() { "align-items" },  "center");

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.6 RELEASED!

Postby JS-Support @Userware » Wed Nov 20, 2019 5:29 am

Thanks. We are going to look into this. By the way, the replacement for the deprecated method "CSharpXamlForHtml5.DomManagement.GetDomElementFromControl" is "CSHTML5.Interop.GetDiv(control)".

You can make changes to the CSHTML5 code base and reference it from your project. Feel free to make pull requests if you find some fixes.

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.6 RELEASED!

Postby Black-Byte » Thu Nov 28, 2019 3:00 am

Hi,

here only a quick fix for those people that have the same problem like me. When i'm building a project with cshtml5 and Visual Studio 2017 , i've got allways an error that some files could not be overwritten.
Add following line the pre build process in your solution

Code: Select all

rd /s /q "$(TargetDir)Output\app-cshtml5"


Greets

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.6 RELEASED!

Postby JS-Support @Userware » Mon Dec 02, 2019 12:56 am

Thanks a lot

Fuzioncode
Posts: 12
Joined: Thu Sep 29, 2016 7:18 am

Re: v2.0 Preview 0.6 RELEASED!

Postby Fuzioncode » Sat Mar 21, 2020 1:02 am

There may be a work around documented but I haven't found it yet but my code below using the web client isn't working in simulator but will work in the web browser. Any suggestion to get it so I can debug everything using webclient in the simulator?

<attached code screenshot>
Attachments
usingwebclient.JPG
usingwebclient.JPG (162.9 KiB) Viewed 104512 times

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.6 RELEASED!

Postby JS-Support @Userware » Tue Apr 21, 2020 2:00 am

The issue can be fixed by adding the "await" keyword before all calls to the "JsonConvert.DeserializeObject", because this is an asynchronous method. You then also need to replace "result.Result.token" with just "result.token". Thanks.

Jrockhub
Posts: 3
Joined: Thu Feb 20, 2020 2:59 am
Contact:

Re: v2.0 Preview 0.6 RELEASED!

Postby Jrockhub » Tue Apr 21, 2020 9:21 am

Hello Support Team,

Thanks for reply, we have already added the "await" which is you mention but we can not see the response data into debug and its asked button.cs not found. Please see below Image.

Debug Point on await.PNG
Debug Point on await.PNG (31.33 KiB) Viewed 103917 times


Then

Error of ButtonBase.PNG
Error of ButtonBase.PNG (15.25 KiB) Viewed 103917 times

Jrockhub
Posts: 3
Joined: Thu Feb 20, 2020 2:59 am
Contact:

Re: v2.0 Preview 0.6 RELEASED!

Postby Jrockhub » Tue Apr 21, 2020 10:49 am

Hello Support Team,

I am use the below JsonConvert, But "Bad Il Format" error remove and there another error comes.

Use JsonConvert - https://gist.githubusercontent.com/csht ... Convert.cs

Error after change JsonConverter

Error after change JsonConverter.PNG
Error after change JsonConverter.PNG (47.85 KiB) Viewed 103915 times


Its for your reference: "returnValue" Not Define.

Screenshot_2020-04-22 Build software better, together.png
Error After Use JsonConverter
Screenshot_2020-04-22 Build software better, together.png (21.04 KiB) Viewed 103915 times



I am available anytime if you want to more know about my side.

Thanks
Rahul J.
CEO Jrockhub
rahul@jrockhub.com

Fuzioncode
Posts: 12
Joined: Thu Sep 29, 2016 7:18 am

Re: v2.0 Preview 0.6 RELEASED!

Postby Fuzioncode » Tue May 05, 2020 7:53 pm

Any update on the above mentioned issue(s)?

fangeles
Posts: 52
Joined: Wed Jan 16, 2019 12:48 am

Re: v2.0 Preview 0.6 RELEASED!

Postby fangeles » Fri Aug 14, 2020 12:32 am

Hi JS-Support,

Can you provide a sample code or style of textbox to implement the PlaceholderText? In WPF, placeholders can be implemented depending on the value of textbox whether has text or none via Triggers, but Triggers are not yet supported in CSHTML5.

Hoping for your response.

Thanks.


Return to “Pre-Releases, Downloads and Announcements”

Who is online

Users browsing this forum: No registered users and 11 guests

 

 

cron