Error in uno platform auto generated file and program.cs - only on Mac - uno-platform

I have a simple app based un uno platform. On Windows I can build and run it without any problem. But on VS for Mac the compiler gives error to the auto generated RemoteControl.g.cs file:
Error CS0826: No best type found for implicitly-typed array (CS0826)
(UnoTeszt.Wasm)
Error CS1503: Argument 2: cannot convert from '?[]'
to 'string[]' (CS1503) (UnoTeszt.Wasm)
// <auto-generated>
// ***************************************************************************************
// This file has been generated by the package Uno.UI.RemoteControl - for Xaml Hot Reload.
// Documentation: https://platform.uno/docs/articles/features/working-with-xaml-hot-reload.html
// ***************************************************************************************
// </auto-generated>
// <autogenerated />
#pragma warning disable // Ignore code analysis warnings
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::1%1", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::109d:3e33:34e7:51fb%4", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("10.111.111.61", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::5805:f7ff:feaa:6ec3%8", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::5805:f7ff:feaa:6ec3%9", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::1d3:92b1:ff7d:cf5%10", 0)]
[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute("fe80::77d1:f7a1:4393:622b%11", 0)]
[assembly: global::Uno.UI.RemoteControl.ProjectConfigurationAttribute(
#"/Users/kistelekig/Documents/Vitarex/FilmesApp/UnoTeszt/UnoTeszt/UnoTeszt.Wasm/UnoTeszt.Wasm.csproj",
new[]{}
)]
And I have an other problem as well in the Program.cs:
[...]/UnoTeszt/UnoTeszt.Wasm/Program.cs(20,20): Error CS0246: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (UnoTeszt.Wasm)
using System;
using Windows.UI.Xaml;
namespace UnoTeszt.Wasm
{
public class Program
{
private static App _app;
static int Main(string[] args)
{
Windows.UI.Xaml.Application.Start(_ => _app = new App());
return 0;
}
}
}
I have the latest version of VS for Mac and MacOS installed.

This usually happens when there's no XAML files tagged as <Page /> in your project. Make sure to correctly reference your shared project.

I have found the root issue. When I create a project via dotnet new:
dotnet new -i Uno.ProjectTemplates.Dotnet
dotnet new unoapp -o App-CrossPlatform
I have the next shared project
App-CrossPlatform\App-CrossPlatform.Shared\App-CrossPlatform.Shared.shproj
App-CrossPlatform\App-CrossPlatform.Shared\App-CrossPlatform.Shared.projitems
But in other (android, ios) projects there are the next imports:
<Import Project="..\App_CrossPlatform.Shared\App_CrossPlatform.Shared.projitems" Label="Shared" Condition="Exists('..\App_CrossPlatform.Shared\App_CrossPlatform.Shared.projitems')" />
Yes... Symbol - vs _...
I have created an issue:
https://github.com/unoplatform/uno/issues/4217

Related

MVVMCross documentation needs updating for latest release?

I'm very new to MVVMCross and I was following the TipCalc tutorial however it seems it was written for an older version MVVMCross. I'm stuck in the TipCalc Android Project section because the MvvmCross package doesnt have a class called MvxAndroidApplication.
using System;
using Android.App;
using Android.Runtime;
using MvvmCross.Platforms.Android.Core; // this namespace doesn't exist
using MvvmCross.Platforms.Android.Views;
using TipCalc.Core;
namespace TipCalc.Droid
{
[Application]
public class MainApplication : MvxAndroidApplication<MvxAndroidSetup<App>, App>
{
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}
}
}
The issue was with the Android version in the Project settings. Details in this link https://github.com/MvvmCross/MvvmCross/pull/3958

Net Core 2: Cannot inherit from KeyNotFoundException

I have something weird:
I had a class like this:
using System;
using System.Collections.Generic;
namespace My.Client
{
public class XNotFoundException : KeyNotFoundException
{
public XFoundException(string s, Exception e) : base(s, e)
{
}
}
}
This class is published via nuget package which contains Refit 4.3.0 and AspNetCore.All 2.0.6.
A project which references this package tries to use the class.. but the build cannot find the class. Other classes from this package work just fine. The error they receive is:
CS0246: The type or namespace name 'XNotFoundException' could not be
found (are you missing a using directive or an assembly reference?)
If I inherit from Exception instead of KeyNotFoundException, it "works". But why? Is there some complication that I missed?

SignalR, Owin do not work after VS2015 move and package updates

I recently upgraded to VS2015 (did not remove VS2013 or 2010). NuGet did not instal properly. While the project ran it loaded with streaming messages re package updating. I just removed and reinstalled NuGet and updated all packages.
Now I have 2 problems that could be related.
1) 134 errors. Everything to do with SignalR and Owin is failing with messages like:
'type or namespace 'Hub' could not be found'.
Here is the key code. Other Usings were greyed out as unnecessary, and are removed.
using System;
namespace SignalR
{
[Microsoft.SignalR.HubName("SeekerHub")]
public class SeekerHub : Hub
{
private static Decimal number;
public static void SendMessage(string message)
{
//StartTimer();
//var callingClient = Context.ConnectionId;
var hubContext = GlobalHost.ConnectionManager.GetHubContext<SeekerHub>();
if (Decimal.TryParse(message, out number))
{
if (number == 0)
{ }
hubContext.Clients.All.receiveUpdate(message);
}
else
hubContext.Clients.All.receiveNotification(message);
}
}
}
2) 6 warnings that relate to updating. All relate to the same SignalR/Owin area but the message suggests that it is looking in the VS2013/localhost xyz/ file and not in the VS2015 file. Is there a way I can change the pointer when the package looks to update itself?
Thanks, in advance, for any help.

Exception running application when adding insights to application using Application Insights Status Monitor Preview

I'm playing around with the preview, and tried adding insights to a IIS web application deployed locally on my machine. It's a .Net 4.5 application running in a nothing out of the ordinary application pool. When starting the application after adding insights, I get this exception:
Could not load file or assembly 'Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I tried "Enable 32-Bit Applications" to both true and false with no difference in result.
Has anyone experienced a similar error?
Unfortunately ASP.NET tries to load literally everything that is in \bin as managed assemblies
Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll is not a managed assembly, but ASP.NET Web App should not fail with yellow page in this case, you would see it only in FusLogvw.
Do you use any web publishing?
Did you precompile your web site on publish?
Could you provide full stack trace of the exception?
I've just come across this issue, and after a few hours found it was due to a conflict with FluentSecurity.
It's detailed here: https://github.com/kristofferahl/FluentSecurity/issues/70
The work-around was to add the following lines just before calling SecurityConfigurator.Configure():
SecurityDoctor.Current.EventListenerScannerSetup = scan =>
{
scan.ExcludeAssembly(file => Path.GetFileName(file).Equals("Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll"));
scan.ExcludeAssembly(file => Path.GetFileName(file).Equals("Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll"));
};
Hope this helps somebody else.
My inner exception pointed to WebActivator. So I Uninstall-Package WebActivator -Force, added the appropriate calls in Application_Start and all was good again.
I'm still testing this but I think I've resolved this problem....
The solution is based on the same solution as the SQL Spatial Types native .dll solution; if you know this you'll see the similarity between this and that package.
Step 1
Go Create a new subdirectory in the MVC project and under this two more sub-directories; I used :
MVCRoot ---> ApplicationInsights/x86
---> ApplicationInsights/x64
Under each directory add a linked item from the package directory, this was :
../packages\Microsoft.Diagnostics.Instrumentation.Extensions.Intercept.0.12.0-build02810\lib\native\x64\Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll
and
../packages\Microsoft.Diagnostics.Instrumentation.Extensions.Intercept.0.12.0-build02810\lib\native\x86\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll
respectively.
I then add this code in a file in the 'root' of the AppplicationInsights folder called loader.cs which looked like this:
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
namespace ApplicationInsights
{
/// <summary>
/// Utility methods related to CLR Types for SQL Server
/// </summary>
internal class Utilities
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr LoadLibrary(string libname);
/// <summary>
/// Loads the required native assemblies for the current architecture (x86 or x64)
/// </summary>
/// <param name="rootApplicationPath">
/// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
/// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
/// </param>
public static void LoadNativeAssemblies(string rootApplicationPath)
{
var nativeBinaryPath = IntPtr.Size > 4
? Path.Combine(rootApplicationPath, #"ApplicationInsights\x64\")
: Path.Combine(rootApplicationPath, #"ApplicationInsights\x86\");
CheckAddDllPath(nativeBinaryPath);
// LoadNativeAssembly(nativeBinaryPath,
// IntPtr.Size > 4
// ? "Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll"
// : "Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll");
}
public static void CheckAddDllPath(string dllPath)
{
// find path to 'bin' folder
var pathsToAdd = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, dllPath });
// get current search path from environment
var path = Environment.GetEnvironmentVariable("PATH") ?? "";
// add 'bin' folder to search path if not already present
if (!path.Split(Path.PathSeparator).Contains(pathsToAdd, StringComparer.CurrentCultureIgnoreCase))
{
path = string.Join(Path.PathSeparator.ToString(), new string[] { path, pathsToAdd });
Environment.SetEnvironmentVariable("PATH", path);
}
}
private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName)
{
var path = Path.Combine(nativeBinaryPath, assemblyName);
var ptr = LoadLibrary(path);
if (ptr == IntPtr.Zero)
{
throw new Exception(string.Format(
"Error loading {0} (ErrorCode: {1})",
assemblyName,
Marshal.GetLastWin32Error()));
}
}
}
}
I then added this to the global.asax this so:
protected override void Application_Start(object sender, EventArgs e)
{
ApplicationInsights.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
}
So far it seems to be passed events so far as I can tell. All come back and update this should I find a problem with what I've done.
At least the MVC application now starts :-)
UPDATE: This is not the end of the story :-(
I had to also modify the Microsoft.Diagnostics.Instrumentation.Extensions.Intercept.props file which is under the build directory of the package to make it not include the files into the bin directory.
When I was done it looked like this :
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\..\lib\native\x86\Microsoft.ApplicationInsights.Extensions.Intercept_x86.dll">
<CopyToOutputDirectory>None</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)\..\lib\native\x64\Microsoft.ApplicationInsights.Extensions.Intercept_x64.dll">
<CopyToOutputDirectory>None</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
I've had to check in this package into my source control system as I think I'm now going to be faced with the problem with Continuous Build restoring a fresh copy of the package which I don't want.
I can't wait for MS to come up with a proper fix for this.
I've just deleted everything in my /bin folder and it seemed to have resolved the issue. Not sure what happen or anything, it's a project i haven't touched in ages. But it solved it :)

xSocket WebRTC Sample error

Hi i have a problem i have a aplication that i m desenvolving an its the same princepel like facebook like a social engine in mvc 4 i am trying to put video-conference i already tried in a empty asp.net mvc4 empty internet application and it works xSocket.net WebRTC Sample so where is my error
so i followed the steps PM> Install-Package XSockets.Sample.WebRTC
1: Add a new XSockets.Web.Bootstrapper (ctrl+shift+a)
2: Under the "Web" tab go to the "Servers" section and set Use Visual Studio Development Server
using System.Web;
using XSockets.Core.Common.Socket;
[assembly: PreApplicationStartMethod(typeof(basicWebRTC.XSocketsWebBootstrapper1), "Start")]
namespace basicWebRTC
{
public static class XSocketsWebBootstrapper1
{
private static IXSocketServerContainer wss;
public static void Start()
{
wss = XSockets.Plugin.Framework.Composable.GetExport<IXSocketServerContainer>(); // when e start An exception of type 'XSockets.Plugin.Framework.Exceptions.ExportException' occurred in XSockets.Plugin.Framework.dll but was not handled in user code //
wss.StartServers();
}
}
}

Resources