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?
Related
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
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
This is not working (anymore): getting this error
CS0006: Metadata file 'Microsoft.Azure.ServiceBus' run.csx(11,23) and CS0234: The type or namespace name 'ServiceBus' was not found
#r "Newtonsoft.Json"
#r "Microsoft.WindowsAzure.Storage"
#r "Microsoft.Azure.ServiceBus"
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using System.Net;
using Microsoft.Azure.ServiceBus;
public static async Task Run(Message mySbMsg, ILogger log)
any idea?
thank you
#r "..\\bin\\Microsoft.Azure.ServiceBus.dll"
using System;
using System.Threading.Tasks;
using Microsoft.Azure.ServiceBus;
public static async Task Run(Message mySbMsg, ILogger log)
{
}
This assembly is not automatically added. take a look at following link for assemblies which are automatically added
https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#referencing-external-assemblies
The following code no longer registers correctly with the IOC. I am currently trying to switch to the Community.Plugins.Sqlite library.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using Cirrious.MvvmCross.Community.Plugins.Sqlite;
using FlashCardApp.Core.Entities;
using FlashCardApp.Core.Managers.FlashCardApp.Core.Services;
using FlashCardApp.Core.ViewModels.Dictionary;
namespace FlashCardApp.Core.Managers
{
class EnglishManager : IEnglishManager
{
private readonly ISQLiteConnection _connection;
public EnglishManager(ISQLiteConnectionFactory factory)
{
_connection = factory.Create("Dictionary.sqlite");
// _connection.CreateTable<English>();
}
I get the following stack trace error
mvx:Warning: 2.06 Problem creating viewModel of type DictionaryViewModel - problem MvxException: Failed to resolve parameter for parameter factory of type ISQLiteConnectionFactory when creating FlashCardApp.Core.Managers.EnglishManager at Cirrious.CrossCore.IoC.MvxSimpleIoCContainer.GetIoCParameterValues(Type type, ConstructorInfo firstConstructor)
How does one go about registering an ISQLiteConnectionFactory in a constructor. Or is there a new method of using this factory under the community plugin?
Edit: I added the community.sqlite plugin to my app.store project and now the ISQLFactory seems to be registering and creating but I get the following error
A first chance exception of type 'System.EntryPointNotFoundException' occurred in Cirrious.MvvmCross.Community.Plugins.Sqlite.WindowsStore.DLL
'FlashCardApp.Store.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.DLL'
and
Unable to find an entry point named 'sqlite3_win32_set_directory' in DLL 'sqlite3'.
Thanks in advance
JH
I downloaded System.Data.SQLite, and tried to compile the following sample code.
using System;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
namespace test
{
class Program
{
static void Main(string[] args)
{
SQLiteConnection.CreateFile("/Users/smcho/Desktop/SQLite-1/example/mydatabasefile.db3");
}
}
}
I ran the following command
mcs db.cs -r:System.Data.dll -r:System.Data.SQLite.dll
But, I got the error messages as follows.
** (/opt/local/lib/mono/1.0/mcs.exe:43249): WARNING **: The class System.Data.Common.DbConnection could not be loaded, used in System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
db.cs(12,7): error CS0103: The name `SQLiteConnection' does not exist in the current context
Compilation failed: 1 error(s), 0 warnings
What might be wrong?
Using the gmcs instead of mcs solved this issue.
gmcs db.cs -r:System.Data.dll,System.Data.SQLite.dll